'DefaultObserver.emit() does not raise when it observes an error event
with a message that causes L{repr} to raise.'

def test_emitEventWithBrokenRepr(self):

    class Ouch(object, ):
        def __repr__(self):
            return str((1 / 0))
    message = ('foo', Ouch())
    event = dict(message=message, isError=1)
    observer = log.DefaultObserver()
    with StringIO() as output:
        observer.stderr = output
        observer.emit(event)
        self.assertTrue(output.getvalue().startswith('foo    <Ouch    instance'))
