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

Method test_result

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

Source from the content-addressed store, hash-verified

273 self.assertFalse(f.cancel())
274
275 def test_result(self):
276 f = self._new_future(loop=self.loop)
277 self.assertRaises(asyncio.InvalidStateError, f.result)
278
279 f.set_result(42)
280 self.assertFalse(f.cancelled())
281 self.assertTrue(f.done())
282 self.assertEqual(f.result(), 42)
283 self.assertEqual(f.exception(), None)
284 self.assertRaises(asyncio.InvalidStateError, f.set_result, None)
285 self.assertRaises(asyncio.InvalidStateError, f.set_exception, None)
286 self.assertFalse(f.cancel())
287
288 def test_exception(self):
289 exc = RuntimeError()

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected