Skip to content

Commit 5216591

Browse files
committed
add test
1 parent 045091d commit 5216591

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Lib/test/test_syntax.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3538,6 +3538,17 @@ def src(depth):
35383538
self._check_error(src(CO_MAXBLOCKS + 1),
35393539
"too many statically nested blocks")
35403540

3541+
def test_invalid_starred_for_target_in_async_comprehension(self):
3542+
sources = [
3543+
"async def f():\n {a async for b in d for *(b,) in e}",
3544+
"async def f():\n [a async for b in d for *(b,) in e]",
3545+
"async def f():\n {a: a async for b in d for *(b,) in e}",
3546+
]
3547+
for src in sources:
3548+
with self.subTest(src=src):
3549+
self._check_error(
3550+
src, "starred assignment target must be in a list or tuple")
3551+
35413552
@support.cpython_only
35423553
def test_error_on_parser_stack_overflow(self):
35433554
source = "-" * 100000 + "4"

0 commit comments

Comments
 (0)