summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_coroutines.py
diff options
context:
space:
mode:
authorZsolt Dollenstein <zsol.zsol@gmail.com>2018-04-27 15:58:56 (GMT)
committerYury Selivanov <yury@magic.io>2018-04-27 15:58:56 (GMT)
commite2396506606115e785c94ec129eb86e2ed0aa744 (patch)
treeceee4cab03aeb3f211ffbc7039fc16981be15e40 /Lib/test/test_coroutines.py
parent078c4e3519deeef8014541925da057bb064eb5a8 (diff)
downloadcpython-e2396506606115e785c94ec129eb86e2ed0aa744.zip
cpython-e2396506606115e785c94ec129eb86e2ed0aa744.tar.gz
cpython-e2396506606115e785c94ec129eb86e2ed0aa744.tar.bz2
bpo-33363: raise SyntaxError for async for/with outside async functions (#6616)
Diffstat (limited to 'Lib/test/test_coroutines.py')
-rw-r--r--Lib/test/test_coroutines.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index 10f7cca..47753e2 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -362,7 +362,22 @@ class AsyncBadSyntaxTest(unittest.TestCase):
"""def foo():
async def bar():
pass\nawait a
- """]
+ """,
+ """def foo():
+ async for i in arange(2):
+ pass
+ """,
+ """def foo():
+ async with resource:
+ pass
+ """,
+ """async with resource:
+ pass
+ """,
+ """async for i in arange(2):
+ pass
+ """,
+ ]
for code in samples:
with self.subTest(code=code), self.assertRaises(SyntaxError):