<s> """<STR_LIT>""" <EOL> import sys <EOL> from timeit import Timer <EOL> import pystache <EOL> examples = [ <EOL> ( """<STR_LIT>""" , <EOL> { "<STR_LIT>" : { "<STR_LIT:name>" : "<STR_LIT>" } } , <EOL> "<STR_LIT>" ) , <EOL> ( """<STR_LIT>""" , <EOL> { '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : [ <EOL> { '<STR_LIT:name>' : "<STR_LIT>" , '<STR_LIT:body>' : "<STR_LIT>" } , <EOL> { '<STR_LIT:name>' : "<STR_LIT>" , '<STR_LIT:body>' : "<STR_LIT>" } , <EOL> { '<STR_LIT:name>' : "<STR_LIT>" , '<STR_LIT:body>' : "<STR_LIT>" } , <EOL> { '<STR_LIT:name>' : "<STR_LIT>" , '<STR_LIT:body>' : "<STR_LIT>" } , <EOL> { '<STR_LIT:name>' : "<STR_LIT>" , '<STR_LIT:body>' : "<STR_LIT>" } ] } , <EOL> """<STR_LIT>""" ) , <EOL> ] <EOL> def make_test_function ( example ) : <EOL> template , context , expected = example <EOL> def test ( ) : <EOL> actual = pystache . render ( template , context ) <EOL> if actual != expected : <EOL> raise Exception ( "<STR_LIT>" % ( expected , actual ) ) <EOL> return test <EOL> def main ( sys_argv ) : <EOL> args = sys_argv [ <NUM_LIT:1> : ] <EOL> count = int ( args [ <NUM_LIT:0> ] ) <EOL> print "<STR_LIT>" % count <EOL> print <EOL> for example in examples : <EOL> test = make_test_function ( example ) <EOL> t = Timer ( test , ) <EOL> print min ( t . repeat ( repeat = <NUM_LIT:3> , number = count ) ) <EOL> print "<STR_LIT>" <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( sys . argv ) </s>
