diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-08-10 13:47:11 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-10 13:47:11 (GMT) |
| commit | 52d481f15c953e06155e65ca823c8f6cae7a6b65 (patch) | |
| tree | f0fb7a027b807d1cc81b7c6633165dd31ad759ac /Lib/lib2to3/tests/test_parser.py | |
| parent | 2e1fef541c4a0a227af7bf1b59bfbccd3fb1a45e (diff) | |
| download | cpython-52d481f15c953e06155e65ca823c8f6cae7a6b65.zip cpython-52d481f15c953e06155e65ca823c8f6cae7a6b65.tar.gz cpython-52d481f15c953e06155e65ca823c8f6cae7a6b65.tar.bz2 | |
make lib2to3 parse async generators everywhere (GH-6588)
(cherry picked from commit 149addd4960d634ce672ab5fc17e0e785a0cdcd0)
Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
Diffstat (limited to 'Lib/lib2to3/tests/test_parser.py')
| -rw-r--r-- | Lib/lib2to3/tests/test_parser.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py index 1aba0e8..5eefb5a 100644 --- a/Lib/lib2to3/tests/test_parser.py +++ b/Lib/lib2to3/tests/test_parser.py @@ -200,20 +200,27 @@ class TestAsyncAwait(GrammarTest): self.validate("""await = 1""") self.validate("""def async(): pass""") - def test_async_with(self): + def test_async_for(self): self.validate("""async def foo(): async for a in b: pass""") - self.invalid_syntax("""def foo(): - async for a in b: pass""") - - def test_async_for(self): + def test_async_with(self): self.validate("""async def foo(): async with a: pass""") self.invalid_syntax("""def foo(): async with a: pass""") + def test_async_generator(self): + self.validate( + """async def foo(): + return (i * 2 async for i in arange(42))""" + ) + self.validate( + """def foo(): + return (i * 2 async for i in arange(42))""" + ) + class TestRaiseChanges(GrammarTest): def test_2x_style_1(self): |
