Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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))
Exemplo n.º 3
0
 def test_passInException(self):
     """
     SynchronousFailure takes an Exception instance as its parameter.
     """
     failure = SynchronousFailure(RuntimeError("hello"))
     self.assertTrue(failure.check(RuntimeError))