#NEWLINE# def flakes( input , * expectedOutputs , **kw ) : #NEWLINE# #INDENT# tree = compile ( textwrap . dedent ( input ) , '<test>' , 'exec' , PyCF_ONLY_AST ) #NEWLINE# results = checker . Checker ( tree , ** kw ) #NEWLINE# outputs = [ message . type for message in results . messages ] #NEWLINE# expectedOutputs = list ( expectedOutputs ) #NEWLINE# outputs . sort ( key = ( lambda t : t . name ) ) #NEWLINE# expectedOutputs . sort ( key = ( lambda t : t . name ) ) #NEWLINE# assert ( outputs == expectedOutputs ) , ( '\nfor input:\n%s\nexpected outputs:\n%r\nbut got:\n%s' % ( input , expectedOutputs , '\n' . join ( [ str ( o ) for o in expectedOutputs . messages ] ) ) ) #NEWLINE# return results