'If the C{"log_failure"} key exists in an event, the observer appends
the failure\'s traceback to the output.'

def test_observeFailure(self):

    with StringIO() as fileHandle:
        observer = textFileLogObserver(fileHandle)
        try:
            (1 / 0)
        except ZeroDivisionError:
            failure = Failure()
        event = dict(log_failure=failure)
        observer(event)
        output = fileHandle.getvalue()
        self.assertTrue(output.split('\n')[1].startswith(' DCTB Traceback    '), msg=repr(output))
