[3.9] bpo-40769: Allow extra surrounding parentheses for invalid annotated assignment rule (GH-20387) (GH-21186)
(cherry picked from commit c8f29ad986f8274fc5fbf889bdd2a211878856b9)
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index e80a867..d6583b9 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -725,6 +725,19 @@
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