summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-11-15 06:49:40 (GMT)
committerGitHub <noreply@github.com>2017-11-15 06:49:40 (GMT)
commit9165f77d5f93a2c12aa0e90853e3ae7212800d3c (patch)
tree96b831acd89b33f865d0be34bdbf5b7431c780c0 /Lib/test/test_syntax.py
parent3bda02222aa3783bf85fc3ff8bc042aefd9c4fd3 (diff)
downloadcpython-9165f77d5f93a2c12aa0e90853e3ae7212800d3c.zip
cpython-9165f77d5f93a2c12aa0e90853e3ae7212800d3c.tar.gz
cpython-9165f77d5f93a2c12aa0e90853e3ae7212800d3c.tar.bz2
bpo-32012: Disallow trailing comma after genexpr without parenthesis. (#4382)
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r--Lib/test/test_syntax.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 5d36581..c8cb705 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -125,17 +125,32 @@ SyntaxError: invalid syntax
From ast_for_call():
->>> def f(it, *varargs):
+>>> def f(it, *varargs, **kwargs):
... return list(it)
>>> L = range(10)
>>> f(x for x in L)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> f(x for x in L, 1)
Traceback (most recent call last):
-SyntaxError: Generator expression must be parenthesized if not sole argument
+SyntaxError: Generator expression must be parenthesized
+>>> f(x for x in L, y=1)
+Traceback (most recent call last):
+SyntaxError: Generator expression must be parenthesized
+>>> f(x for x in L, *[])
+Traceback (most recent call last):
+SyntaxError: Generator expression must be parenthesized
+>>> f(x for x in L, **{})
+Traceback (most recent call last):
+SyntaxError: Generator expression must be parenthesized
+>>> f(L, x for x in L)
+Traceback (most recent call last):
+SyntaxError: Generator expression must be parenthesized
>>> f(x for x in L, y for y in L)
Traceback (most recent call last):
-SyntaxError: Generator expression must be parenthesized if not sole argument
+SyntaxError: Generator expression must be parenthesized
+>>> f(x for x in L,)
+Traceback (most recent call last):
+SyntaxError: Generator expression must be parenthesized
>>> f((x for x in L), 1)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]