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

Method test_run

Lib/test/test_asyncio/test_runners.py:302–317  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

300 self.assertIs(runner.get_loop(), loop)
301
302 def test_run(self):
303 async def f():
304 await asyncio.sleep(0)
305 return 'done'
306
307 with asyncio.Runner() as runner:
308 self.assertEqual('done', runner.run(f()))
309 loop = runner.get_loop()
310
311 with self.assertRaisesRegex(
312 RuntimeError,
313 "Runner is closed"
314 ):
315 runner.get_loop()
316
317 self.assertTrue(loop.is_closed())
318
319 def test_run_non_coro(self):
320 with asyncio.Runner() as runner:

Callers

nothing calls this directly

Calls 7

assertRaisesRegexMethod · 0.80
assertTrueMethod · 0.80
fFunction · 0.50
assertEqualMethod · 0.45
runMethod · 0.45
get_loopMethod · 0.45
is_closedMethod · 0.45

Tested by

no test coverage detected