#NEWLINE# def test_fileWithFlakes( self ) : #NEWLINE# #INDENT# '\n        When a Python source file has warnings, the return code is non-zero\n        and the warnings are printed to stdout.\n        ' #NEWLINE# fd = open ( expected . tempfilepath , 'wb' ) #NEWLINE# fd . write ( 'import contraband\n' . encode ( 'ascii' ) ) #NEWLINE# fd . close ( ) #NEWLINE# d = self . runPyflakes ( [ self . tempfilepath ] ) #NEWLINE# expected = UnusedImport ( self . tempfilepath , Node ( 1 ) , 'contraband' ) #NEWLINE# self . assertEqual ( d , ( ( '%s\n' % expected ) , '' , 1 ) )