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

Method test_cancel_inner_future

Lib/test/test_asyncio/test_tasks.py:869–882  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

867 self.assertFalse(t.cancel())
868
869 def test_cancel_inner_future(self):
870 f = self.new_future(self.loop)
871
872 async def task():
873 await f
874 return 12
875
876 t = self.new_task(self.loop, task())
877 test_utils.run_briefly(self.loop) # start task
878 f.cancel()
879 with self.assertRaises(asyncio.CancelledError):
880 self.loop.run_until_complete(t)
881 self.assertTrue(f.cancelled())
882 self.assertTrue(t.cancelled())
883
884 def test_cancel_both_task_and_inner_future(self):
885 f = self.new_future(self.loop)

Callers

nothing calls this directly

Calls 9

new_futureMethod · 0.95
new_taskMethod · 0.95
taskFunction · 0.85
run_brieflyMethod · 0.80
assertTrueMethod · 0.80
cancelMethod · 0.45
assertRaisesMethod · 0.45
run_until_completeMethod · 0.45
cancelledMethod · 0.45

Tested by

no test coverage detected