"""
if self._state != _PENDING:
raise InvalidStateError('{}: {!r}'.format(self._state, self))
+ if isinstance(exception, type):
+ exception = exception()
self._exception = exception
self._state = _FINISHED
self._schedule_callbacks()
self.assertRaises(asyncio.InvalidStateError, f.set_exception, None)
self.assertFalse(f.cancel())
+ def test_exception_class(self):
+ f = asyncio.Future(loop=self.loop)
+ f.set_exception(RuntimeError)
+ self.assertIsInstance(f.exception(), RuntimeError)
+
def test_yield_from_twice(self):
f = asyncio.Future(loop=self.loop)