def test_set_exception_twice(self): fut = Future() fut.set_exception(RuntimeError) self.assertEqual(fut.exception(), RuntimeError) fut.set_exception(ValueError) self.assertEqual(fut.exception(), RuntimeError)
def test_exception(self): fut = Future() fut.set_exception(ValueError()) self.assertIsInstance(fut.exception(), ValueError) self.assertRaises(ValueError, fut.result)