mirror of
https://github.com/python/cpython.git
synced 2024-11-28 12:31:14 +08:00
gh-94808: [coverage] Add an asynchronous generator test where the generator is already running (#97672)
This commit is contained in:
parent
4e5f2db6f2
commit
5f4ae86a63
@ -378,6 +378,19 @@ class AsyncGenTest(unittest.TestCase):
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user