#NEWLINE# def test_example( self ) : #NEWLINE# #INDENT# saved = sys . stdout #NEWLINE# stdout = io . StringIO ( ) #NEWLINE# try : #NEWLINE# #INDENT# sys . stdout = f #NEWLINE# with open ( self . filename ) as f : #NEWLINE# #INDENT# code = compile ( f . read ( ) , self . filename , 'exec' ) #NEWLINE# exec ( code , { #NEWLINE# #INDENT# '__name__' : '__main__' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# sys . stdout = saved #NEWLINE# #UNINDENT# stdout . seek ( 0 ) #NEWLINE# actual_output = stdout . read ( ) #NEWLINE# self . assertEqual ( u ( self . expected_output ) , u ( actual_output ) )