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

Method test_func_1

Lib/test/test_coroutines.py:532–547  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

530 self.assertNotHasAttr(gen, '__await__')
531
532 def test_func_1(self):
533 async def foo():
534 return 10
535
536 f = foo()
537 self.assertIsInstance(f, types.CoroutineType)
538 self.assertTrue(bool(foo.__code__.co_flags & inspect.CO_COROUTINE))
539 self.assertFalse(bool(foo.__code__.co_flags & inspect.CO_GENERATOR))
540 self.assertTrue(bool(f.cr_code.co_flags & inspect.CO_COROUTINE))
541 self.assertFalse(bool(f.cr_code.co_flags & inspect.CO_GENERATOR))
542 self.assertEqual(run_async(f), ([], 10))
543
544 self.assertEqual(run_async__await__(foo()), ([], 10))
545
546 def bar(): pass
547 self.assertFalse(bool(bar.__code__.co_flags & inspect.CO_COROUTINE))
548
549 def test_func_2(self):
550 async def foo():

Callers

nothing calls this directly

Calls 7

run_asyncFunction · 0.85
run_async__await__Function · 0.85
assertIsInstanceMethod · 0.80
assertTrueMethod · 0.80
assertFalseMethod · 0.80
fooFunction · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected