mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
[3.9] bpo-43272: Fix old parser test failures for backported grammar constructs (GH-24591)
This commit is contained in:
parent
a67fd011ea
commit
f9d1bf2de0
3 changed files with 33 additions and 23 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import unittest
|
||||
from test.support import use_old_parser
|
||||
|
||||
GLOBAL_VAR = None
|
||||
|
||||
|
|
@ -167,6 +168,7 @@ def test_named_expression_invalid_list_comprehension_iterable_expression(self):
|
|||
with self.assertRaisesRegex(SyntaxError, msg):
|
||||
exec(f"lambda: {code}", {}) # Function scope
|
||||
|
||||
@unittest.skipIf(use_old_parser(), "Old parser does not support walruses in set comprehensions")
|
||||
def test_named_expression_invalid_rebinding_set_comprehension_iteration_variable(self):
|
||||
cases = [
|
||||
("Local reuse", 'i', "{i := 0 for i in range(5)}"),
|
||||
|
|
@ -199,6 +201,7 @@ def test_named_expression_invalid_rebinding_set_comprehension_inner_loop(self):
|
|||
with self.assertRaisesRegex(SyntaxError, msg):
|
||||
exec(f"lambda: {code}", {}) # Function scope
|
||||
|
||||
@unittest.skipIf(use_old_parser(), "Old parser does not support walruses in set comprehensions")
|
||||
def test_named_expression_invalid_set_comprehension_iterable_expression(self):
|
||||
cases = [
|
||||
("Top level", "{i for i in (i := range(5))}"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue