summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorBatuhan Taskaya <batuhanosmantaskaya@gmail.com>2020-06-27 18:33:08 (GMT)
committerGitHub <noreply@github.com>2020-06-27 18:33:08 (GMT)
commitc8f29ad986f8274fc5fbf889bdd2a211878856b9 (patch)
treeb4fdbecd0b5f987ffa160cd966263bd77063a06c /Lib/test/test_syntax.py
parent6dcbc2422de9e2a7ff89a4689572d84001e230b2 (diff)
downloadcpython-c8f29ad986f8274fc5fbf889bdd2a211878856b9.zip
cpython-c8f29ad986f8274fc5fbf889bdd2a211878856b9.tar.gz
cpython-c8f29ad986f8274fc5fbf889bdd2a211878856b9.tar.bz2
bpo-40769: Allow extra surrounding parentheses for invalid annotated assignment rule (GH-20387)
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r--Lib/test/test_syntax.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 812a7df..4657fd1 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -733,6 +733,19 @@ SyntaxError: trailing comma not allowed without surrounding parentheses
Traceback (most recent call last):
SyntaxError: trailing comma not allowed without surrounding parentheses
+>>> (): int
+Traceback (most recent call last):
+SyntaxError: only single target (not tuple) can be annotated
+>>> []: int
+Traceback (most recent call last):
+SyntaxError: only single target (not list) can be annotated
+>>> (()): int
+Traceback (most recent call last):
+SyntaxError: only single target (not tuple) can be annotated
+>>> ([]): int
+Traceback (most recent call last):
+SyntaxError: only single target (not list) can be annotated
+
Corner-cases that used to fail to raise the correct error:
>>> def f(*, x=lambda __debug__:0): pass