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

Method test_cancel_yield

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

Source from the content-addressed store, hash-verified

852 (asyncio.CancelledError, ('my message',), 0))
853
854 def test_cancel_yield(self):
855 async def task():
856 await asyncio.sleep(0)
857 await asyncio.sleep(0)
858 return 12
859
860 t = self.new_task(self.loop, task())
861 test_utils.run_briefly(self.loop) # start coro
862 t.cancel()
863 self.assertRaises(
864 asyncio.CancelledError, self.loop.run_until_complete, t)
865 self.assertTrue(t.done())
866 self.assertTrue(t.cancelled())
867 self.assertFalse(t.cancel())
868
869 def test_cancel_inner_future(self):
870 f = self.new_future(self.loop)

Callers

nothing calls this directly

Calls 9

new_taskMethod · 0.95
taskFunction · 0.85
run_brieflyMethod · 0.80
assertTrueMethod · 0.80
assertFalseMethod · 0.80
cancelMethod · 0.45
assertRaisesMethod · 0.45
doneMethod · 0.45
cancelledMethod · 0.45

Tested by

no test coverage detected