Skip to content

Commit

Permalink
gh-94808: [coverage] Add an asynchronous generator test where the gen…
Browse files Browse the repository at this point in the history
…erator is already running (#97672)
  • Loading branch information
zhanpon authored Nov 24, 2022
1 parent 4e5f2db commit 5f4ae86
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Lib/test/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,19 @@ async def async_gen_wrapper():

self.compare_generators(sync_gen_wrapper(), async_gen_wrapper())

def test_async_gen_exception_12(self):
async def gen():
await anext(me)
yield 123

me = gen()
ai = me.__aiter__()
an = ai.__anext__()

with self.assertRaisesRegex(RuntimeError,
r'anext\(\): asynchronous generator is already running'):
an.__next__()

def test_async_gen_3_arg_deprecation_warning(self):
async def gen():
yield 123
Expand Down

0 comments on commit 5f4ae86

Please sign in to comment.