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

Method run2

Lib/test/test_asyncgen.py:1048–1061  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1046 await it.__anext__()
1047
1048 async def run2():
1049 it = foo().__aiter__()
1050
1051 self.assertEqual(await it.__anext__(), 1)
1052 self.assertEqual(await it.__anext__(), 2)
1053 try:
1054 it.__anext__().throw(ZeroDivisionError)
1055 except StopIteration as ex:
1056 self.assertEqual(ex.args[0], 1000)
1057 else:
1058 self.fail('StopIteration was not raised')
1059 self.assertEqual(await it.__anext__(), 4)
1060 with self.assertRaises(StopAsyncIteration):
1061 await it.__anext__()
1062
1063 self.loop.run_until_complete(run1())
1064 self.loop.run_until_complete(run2())

Callers

nothing calls this directly

Calls 7

fooFunction · 0.70
__aiter__Method · 0.45
assertEqualMethod · 0.45
__anext__Method · 0.45
throwMethod · 0.45
failMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected