#NEWLINE# def test_false_unindentor( self ) : #NEWLINE# #INDENT# stream = StringIO ( ) #NEWLINE# printer = PythonPrinter ( line ) #NEWLINE# for line in [ 'try:' , 'elsemyvar = 12' , 'if True:' , "print 'hi'" , None , 'finally:' , 'dosomething' , None ] : #NEWLINE# #INDENT# printer . writeline ( line ) #NEWLINE# #UNINDENT# assert ( stream . getvalue ( ) == "try:\n    elsemyvar = 12\n    if True:\n        print 'hi'\nfinally:\n    dosomething\n" ) , stream . getvalue ( )