async def test_coro_reject(self): p = Promise(success_sleep(), loop=self.loop) with self.assertRaisesRegex(RuntimeError, "Task does not support set_exception operation"): p.reject(Exception("Should Fail")) self.assertEqual(await p, SUCCESS_RESULT)
async def test_rejection(self): promise = Promise(self.fut, log_unhandled_exception=False) exc = Exception("test_rejection") promise.reject(exc) self.assertAsyncRaises(exc, promise) self.assertAsyncRaises(exc, self.fut)