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

Method test_async_gen_aiter_class

Lib/test/test_asyncgen.py:741–756  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

739 self.assertEqual(res, [1, 2])
740
741 def test_async_gen_aiter_class(self):
742 results = []
743 class Gen:
744 async def __aiter__(self):
745 yield 1
746 yield 2
747 g = Gen()
748 async def consume():
749 ait = aiter(g)
750 while True:
751 try:
752 results.append(await anext(ait))
753 except StopAsyncIteration:
754 break
755 self.loop.run_until_complete(consume())
756 self.assertEqual(results, [1, 2])
757
758 def test_aiter_idempotent(self):
759 async def gen():

Callers

nothing calls this directly

Calls 4

consumeFunction · 0.85
GenClass · 0.70
run_until_completeMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected