def test_check(self): """ Check accepts multiple exception types, and returns the exception type which matched. """ failure = SynchronousFailure(RuntimeError()) self.assertEquals(failure.check(ZeroDivisionError, RuntimeError), RuntimeError)
def test_getExceptionFromEnvironment(self): """ SynchronousFailure infers the current exception and traceback from the environment. """ try: 1/0 except: failure = SynchronousFailure() self.assertTrue(failure.check(ZeroDivisionError))
def test_passInException(self): """ SynchronousFailure takes an Exception instance as its parameter. """ failure = SynchronousFailure(RuntimeError("hello")) self.assertTrue(failure.check(RuntimeError))