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

Method run

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

Source from the content-addressed store, hash-verified

1070 yield v * 100
1071
1072 async def run():
1073 it = foo().__aiter__()
1074
1075 try:
1076 it.__anext__().send(None)
1077 except StopIteration as ex:
1078 self.assertEqual(ex.args[0], 1)
1079 else:
1080 self.fail('StopIteration was not raised')
1081
1082 try:
1083 it.__anext__().send(10)
1084 except StopIteration as ex:
1085 self.assertEqual(ex.args[0], 10)
1086 else:
1087 self.fail('StopIteration was not raised')
1088
1089 try:
1090 it.__anext__().send(12)
1091 except StopIteration as ex:
1092 self.assertEqual(ex.args[0], 1200)
1093 else:
1094 self.fail('StopIteration was not raised')
1095
1096 with self.assertRaises(StopAsyncIteration):
1097 await it.__anext__()
1098
1099 self.loop.run_until_complete(run())
1100

Calls 15

gc_collectFunction · 0.90
assertTupleEqualMethod · 0.80
assertIsInstanceMethod · 0.80
assertRaisesRegexMethod · 0.80
fooFunction · 0.70
genFunction · 0.70
__aiter__Method · 0.45
sendMethod · 0.45
__anext__Method · 0.45
assertEqualMethod · 0.45
failMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected