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

Method wrong_loop_in_cond

Lib/test/test_asyncio/test_locks.py:738–750  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

736 await cond.acquire()
737
738 async def wrong_loop_in_cond():
739 # Same analogy here with the condition's loop.
740 lock = asyncio.Lock()
741 async with lock:
742 with self.assertRaises(TypeError):
743 asyncio.Condition(lock, loop=loop)
744 cond = asyncio.Condition(lock)
745 cond._loop = loop
746 with self.assertRaisesRegex(
747 RuntimeError,
748 "is bound to a different event loop",
749 ):
750 await cond.wait()
751
752 await wrong_loop_in_lock()
753 await wrong_loop_in_cond()

Callers

nothing calls this directly

Calls 5

waitMethod · 0.95
LockMethod · 0.80
assertRaisesRegexMethod · 0.80
assertRaisesMethod · 0.45
ConditionMethod · 0.45

Tested by

no test coverage detected