<s> from mako . template import Template <EOL> from mako import util <EOL> from test . util import result_lines , flatten_result <EOL> from test import TemplateTest , eq_ <EOL> class CallTest ( TemplateTest ) : <EOL> def test_call ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def test_compound_call ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> def test_new_syntax ( self ) : <EOL> """<STR_LIT>""" <EOL> t = Template ( """<STR_LIT>""" ) <EOL> eq_ ( <EOL> result_lines ( t . render ( ) ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:q>' , '<STR_LIT>' ] <EOL> ) <EOL> def test_ccall_caller ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] <EOL> def test_stack_pop ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> def test_conditional_call ( self ) : <EOL> """<STR_LIT>""" <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> def test_chained_call ( self ) : <EOL> """<STR_LIT>""" <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" , <EOL> '<STR_LIT>' <EOL> ] <EOL> def test_nested_call ( self ) : <EOL> """<STR_LIT>""" <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( x = <NUM_LIT:5> ) ) == [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> def test_nested_call_2 ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( x = <NUM_LIT:5> ) ) == [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> def test_nested_call_3 ( self ) : <EOL> template = Template ( '''<STR_LIT>''' ) <EOL> assert flatten_result ( template . render ( ) ) == "<STR_LIT:foo>" <EOL> def test_nested_call_4 ( self ) : <EOL> base = """<STR_LIT>""" <EOL> template = Template ( base + """<STR_LIT>""" ) <EOL> eq_ ( <EOL> flatten_result ( template . render ( ) ) , <EOL> "<STR_LIT>" <EOL> ) <EOL> template = Template ( base + """<STR_LIT>""" ) <EOL> eq_ ( <EOL> flatten_result ( template . render ( ) ) , <EOL> "<STR_LIT>" <EOL> ) <EOL> def test_chained_call_in_nested ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" , <EOL> '<STR_LIT>' <EOL> ] <EOL> def test_call_in_nested ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" ] <EOL> def test_composed_def ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ '<STR_LIT>' ] <EOL> def test_regular_defs ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> def test_call_in_nested_2 ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , "<STR_LIT>" , '<STR_LIT>' , '<STR_LIT>' ] <EOL> class SelfCacheTest ( TemplateTest ) : <EOL> """<STR_LIT>""" <EOL> def test_basic ( self ) : <EOL> t = Template ( """<STR_LIT>""" ) <EOL> assert result_lines ( t . render ( ) ) == [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] </s>
