def test_fail(self):
        result = []

        def failed(res):
            result.append(res)

        e = TwistedEvent()

        e.wait().addErrback(failed)
        self.assertEqual(result, [])

        f = Failure(Exception())
        e.fail(f)
        self.assertEqual(result, [f])

        self.assertRaises(AlreadyFiredError, e.fire)
        self.assertRaises(AlreadyFiredError, e.fail, f)

        e.wait().addErrback(failed)
        self.assertEqual(result, [f, f])

        e.fail_if_not_fired(None)

        e = TwistedEvent()

        e.wait().addErrback(failed)
        e.fail_if_not_fired(f)
        self.assertEqual(result, [f, f, f])
Test event failure.
dataset/ETHPy150Open tweetdeck/txAMQP/src/txamqp/test/test_event.py/EventTest.test_fail