#NEWLINE# def test( self ) : #NEWLINE# #INDENT# m = PythonModule ( ) #NEWLINE# m . stmt ( 'import sys' ) #NEWLINE# m . stmt ( 'import os' ) #NEWLINE# m . sep ( ) #NEWLINE# m . comment ( 'hi there' , box = True ) #NEWLINE# m . stmt ( R ( x = 18 ) ) #NEWLINE# with m . if_ ( 'x > 5' ) : #NEWLINE# #INDENT# m . stmt ( "print '''hello\nworld'''" ) #NEWLINE# with m . if_ ( ( E ( 'z' ) == 18 ) ) : #NEWLINE# #INDENT# m . comment ( 'foo' , 'bar' ) #NEWLINE# m . stmt ( "print 'lala'" ) #NEWLINE# #UNINDENT# with m . if_ ( 'z == 19' ) : #NEWLINE# #INDENT# m . stmt ( "print 'gaga'" ) #NEWLINE# #UNINDENT# m . stmt ( "print 'zaza'" ) #NEWLINE# #UNINDENT# m . sep ( ) #NEWLINE# with m . def_ ( 'foo' , 'a' , 'b' , 'c' ) : #NEWLINE# #INDENT# m . stmt ( 'return a + b + c' ) #NEWLINE# #UNINDENT# with m . def_ ( 'bar' , 'a' , 'b' , 'c' ) : #NEWLINE# #INDENT# m . return_ ( 'a * b * c' ) #NEWLINE# #UNINDENT# m . stmt ( "print 'papa'" ) #NEWLINE# output = "import sys\nimport os\n\n################################################################################\n# hi there\n################################################################################\nx = 18\nif x > 5:\n    print '''hello\nworld'''\n    if (z == 18):\n        # foo\n        # bar\n        print 'lala'\n    if z == 19:\n        print 'gaga'\n    print 'zaza'\n\ndef foo(a, b, c):\n    return a + b + c\n\ndef bar(a, b, c):\n    return a * b * c\n\nprint 'papa'\n" #NEWLINE# self . assertEqual ( str ( m ) , output )