MCPcopy Index your code
hub / github.com/python/cpython / test_exception

Method test_exception

Lib/test/test_asyncio/test_futures.py:288–300  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

286 self.assertFalse(f.cancel())
287
288 def test_exception(self):
289 exc = RuntimeError()
290 f = self._new_future(loop=self.loop)
291 self.assertRaises(asyncio.InvalidStateError, f.exception)
292
293 f.set_exception(exc)
294 self.assertFalse(f.cancelled())
295 self.assertTrue(f.done())
296 self.assertRaises(RuntimeError, f.result)
297 self.assertEqual(f.exception(), exc)
298 self.assertRaises(asyncio.InvalidStateError, f.set_result, None)
299 self.assertRaises(asyncio.InvalidStateError, f.set_exception, None)
300 self.assertFalse(f.cancel())
301
302 def test_stop_iteration_exception(self, stop_iteration_class=StopIteration):
303 exc = stop_iteration_class()

Callers

nothing calls this directly

Calls 10

_new_futureMethod · 0.95
assertFalseMethod · 0.80
assertTrueMethod · 0.80
assertRaisesMethod · 0.45
set_exceptionMethod · 0.45
cancelledMethod · 0.45
doneMethod · 0.45
assertEqualMethod · 0.45
exceptionMethod · 0.45
cancelMethod · 0.45

Tested by

no test coverage detected