Skip to content

Commit 7eb3d1e

Browse files
committed
Move parenthesized walrus target test to docstring in test_syntax
1 parent 84fbba0 commit 7eb3d1e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Lib/test/test_syntax.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,6 +2686,13 @@ def f(x: *b)
26862686
>>> f(x = 5, *:)
26872687
Traceback (most recent call last):
26882688
SyntaxError: Invalid star expression
2689+
2690+
Invalid assignment expressions with parenthesized targets:
2691+
2692+
>>> ((a) := 1)
2693+
Traceback (most recent call last):
2694+
...
2695+
SyntaxError: cannot parenthesize target name in assignment expression
26892696
"""
26902697

26912698
import re
@@ -2852,11 +2859,6 @@ def test_assign_del(self):
28522859
# report "cannot delete name"
28532860
self._check_error("del a += b", "invalid syntax")
28542861

2855-
def test_parenthesized_named_expression_target(self):
2856-
self._check_error(
2857-
"((a) := 1)",
2858-
"cannot parenthesize target name in assignment expression")
2859-
28602862
def test_global_param_err_first(self):
28612863
source = """if 1:
28622864
def error(a):

0 commit comments

Comments
 (0)