summaryrefslogtreecommitdiff
path: root/Lib/lib2to3/tests
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-08-10 02:56:50 -0700
committerGitHub <noreply@github.com>2021-08-10 11:56:50 +0200
commit0e63776c4f3d0b972344368f62b91eb96be69fe3 (patch)
treefb4ffcaf9cb4fb0f564283b72fe4dbe12dd954d4 /Lib/lib2to3/tests
parentede1dc416de5eece02170e03387dc8496c2d00ae (diff)
downloadcpython-git-0e63776c4f3d0b972344368f62b91eb96be69fe3.tar.gz
make lib2to3 parse async generators everywhere (GH-6588) (GH-27703)
(cherry picked from commit 149addd4960d634ce672ab5fc17e0e785a0cdcd0) Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
Diffstat (limited to 'Lib/lib2to3/tests')
-rw-r--r--Lib/lib2to3/tests/test_parser.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py
index d5db66b9b1..034b5039cf 100644
--- a/Lib/lib2to3/tests/test_parser.py
+++ b/Lib/lib2to3/tests/test_parser.py
@@ -196,20 +196,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):