summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-08-18 20:09:21 (GMT)
committerGitHub <noreply@github.com>2021-08-18 20:09:21 (GMT)
commitb2f68b190035540872072ac1d2349e7745e85596 (patch)
treebd130a26b96442cbe45d4b3c397f39ad6faaf057 /Lib/test/test_syntax.py
parent31ee985db86c1339d00bd0d3cc1712019460670a (diff)
downloadcpython-b2f68b190035540872072ac1d2349e7745e85596.zip
cpython-b2f68b190035540872072ac1d2349e7745e85596.tar.gz
cpython-b2f68b190035540872072ac1d2349e7745e85596.tar.bz2
bpo-44947: Refine the syntax error for trailing commas in import statements (GH-27814)
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r--Lib/test/test_syntax.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index c77aafe..88503dc 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -1202,6 +1202,13 @@ SyntaxError: trailing comma not allowed without surrounding parentheses
Traceback (most recent call last):
SyntaxError: trailing comma not allowed without surrounding parentheses
+# Check that we dont raise the "trailing comma" error if there is more
+# input to the left of the valid part that we parsed.
+
+>>> from t import x,y, and 3
+Traceback (most recent call last):
+SyntaxError: invalid syntax
+
>>> (): int
Traceback (most recent call last):
SyntaxError: only single target (not tuple) can be annotated