Skip to content

Commit e115e17

Browse files
committed
tests
1 parent 5db01cd commit e115e17

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Lib/test/test_asyncgen.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,24 @@ async def run():
11521152

11531153
self.loop.run_until_complete(run())
11541154

1155+
def test_async_gen_asyncio_anext_tuple_no_exceptions(self):
1156+
# StopAsyncIteration exceptions should be cleared.
1157+
# See: https://github.com/python/cpython/issues/128078.
1158+
1159+
async def foo():
1160+
if False:
1161+
yield (1, 2)
1162+
1163+
async def run():
1164+
it = foo().__aiter__()
1165+
with self.assertRaises(StopAsyncIteration):
1166+
await it.__anext__()
1167+
a, b = await anext(it, ('a', 'b'))
1168+
self.assertEqual(a, 'a')
1169+
self.assertEqual(b, 'b')
1170+
1171+
self.loop.run_until_complete(run())
1172+
11551173
def test_async_gen_asyncio_anext_stopiteration(self):
11561174
async def foo():
11571175
try:

0 commit comments

Comments
 (0)