def failUnlessFailure(self, deferred, *expectedFailures):
        def _cb(ignore):
            raise self.failureException(
                "did not catch an error, instead got %r" % (ignore,))

        def _eb(failure):
            if failure.check(*expectedFailures):
                return failure.value
            else:
                output = ('\nExpected: %r\nGot:\n%s'
                          % (expectedFailures, str(failure)))
                raise self.failureException(output)
        return deferred.addCallbacks(_cb, _eb)
Fail if C{deferred} does not errback with one of C{expectedFailures}.
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/trial/unittest.py/_Assertions.failUnlessFailure