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

Method test_cancel

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

Source from the content-addressed store, hash-verified

262 self.assertEqual(f._cancel_message, 'my new message')
263
264 def test_cancel(self):
265 f = self._new_future(loop=self.loop)
266 self.assertTrue(f.cancel())
267 self.assertTrue(f.cancelled())
268 self.assertTrue(f.done())
269 self.assertRaises(asyncio.CancelledError, f.result)
270 self.assertRaises(asyncio.CancelledError, f.exception)
271 self.assertRaises(asyncio.InvalidStateError, f.set_result, None)
272 self.assertRaises(asyncio.InvalidStateError, f.set_exception, None)
273 self.assertFalse(f.cancel())
274
275 def test_result(self):
276 f = self._new_future(loop=self.loop)

Callers

nothing calls this directly

Calls 7

_new_futureMethod · 0.95
assertTrueMethod · 0.80
assertFalseMethod · 0.80
cancelMethod · 0.45
cancelledMethod · 0.45
doneMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected