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

Method doit

Lib/test/test_asyncio/test_tasks.py:1833–1841  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1831 await asyncio.sleep(dt)
1832
1833 async def doit():
1834 sleeper = self.new_task(loop, sleep(5000))
1835 loop.call_later(0.1, sleeper.cancel)
1836 try:
1837 await sleeper
1838 except asyncio.CancelledError:
1839 return 'cancelled'
1840 else:
1841 return 'slept in'
1842
1843 doer = doit()
1844 self.assertEqual(loop.run_until_complete(doer), 'cancelled')

Callers

nothing calls this directly

Calls 3

new_taskMethod · 0.95
sleepFunction · 0.85
call_laterMethod · 0.45

Tested by

no test coverage detected