summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/tests/test_parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib2to3/tests/test_parser.py')
-rw-r--r--Lib/lib2to3/tests/test_parser.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py
index a0c31e8..ba2bb78 100644
--- a/Lib/lib2to3/tests/test_parser.py
+++ b/Lib/lib2to3/tests/test_parser.py
@@ -629,6 +629,21 @@ class TestLiterals(GrammarTest):
self.validate(s)
+class TestNamedAssignments(GrammarTest):
+
+ def test_named_assignment_if(self):
+ driver.parse_string("if f := x(): pass\n")
+
+ def test_named_assignment_while(self):
+ driver.parse_string("while f := x(): pass\n")
+
+ def test_named_assignment_generator(self):
+ driver.parse_string("any((lastNum := num) == 1 for num in [1, 2, 3])\n")
+
+ def test_named_assignment_listcomp(self):
+ driver.parse_string("[(lastNum := num) == 1 for num in [1, 2, 3]]\n")
+
+
class TestPickleableException(unittest.TestCase):
def test_ParseError(self):
err = ParseError('msg', 2, None, (1, 'context'))