def test_exc(self): for exc in ValueError, KeyError, ZeroDivisionError: f = Present(exception=exc()) self.assertIsInstance(f, Future) self.assertTrue(f.done()) self.assertRaises(exc, f.result)
def test_res(self): for val in 1, 'x', True, False, State(problem=1), lambda: None: f = Present(result=val) self.assertIsInstance(f, Future) self.assertTrue(f.done()) self.assertEqual(f.result(), val)