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

Method test_wait_cancel

Lib/test/test_asyncio/test_locks.py:458–467  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

456 self.assertTrue(t3.result())
457
458 async def test_wait_cancel(self):
459 cond = asyncio.Condition()
460 await cond.acquire()
461
462 wait = asyncio.create_task(cond.wait())
463 asyncio.get_running_loop().call_soon(wait.cancel)
464 with self.assertRaises(asyncio.CancelledError):
465 await wait
466 self.assertFalse(cond._waiters)
467 self.assertTrue(cond.locked())
468
469 async def test_wait_cancel_contested(self):
470 cond = asyncio.Condition()

Callers

nothing calls this directly

Calls 9

waitMethod · 0.95
assertFalseMethod · 0.80
assertTrueMethod · 0.80
ConditionMethod · 0.45
acquireMethod · 0.45
create_taskMethod · 0.45
call_soonMethod · 0.45
assertRaisesMethod · 0.45
lockedMethod · 0.45

Tested by

no test coverage detected