'Round-tripping a failure through L{eventAsJSON} preserves its class and
structure.'

def test_failureStructurePreserved(self):

    events = []
    log = Logger(observer=events.append)
    try:
        (1 / 0)
    except ZeroDivisionError:
        f = Failure()
        log.failure('a    message    about    failure', f)
    import sys
    if (sys.exc_info()[0] is not None):
        sys.exc_clear()
    self.assertEqual(len(events), 1)
    loaded = eventFromJSON(self.savedEventJSON(events[0]))['log_failure']
    self.assertIsInstance(loaded, Failure)
    self.assertTrue(loaded.check(ZeroDivisionError))
    self.assertIsInstance(loaded.getTraceback(), str)
