#NEWLINE# def test_observeFailure( self ) : #NEWLINE# #INDENT# '\n        If the C{"log_failure"} key exists in an event, the observer appends\n        the failure\'s traceback to the output.\n        ' #NEWLINE# with StringIO ( ) as fileHandle : #NEWLINE# #INDENT# observer = FileLogObserver ( fileHandle , ( lambda e : unicode ( e ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# ( 1 / 0 ) #NEWLINE# #UNINDENT# except ZeroDivisionError : #NEWLINE# #INDENT# failure = Failure ( ) #NEWLINE# #UNINDENT# event = dict ( log_failure = failure ) #NEWLINE# observer ( event ) #NEWLINE# output = fileHandle . getvalue ( ) #NEWLINE# self . assertTrue ( output . startswith ( '{0}\nTraceback ' . format ( unicode ( event ) ) ) , 'Incorrect output:\n{0}' . format ( output ) )