mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-96587: Raise SyntaxError
for PEP654 on older feature_version
(#96588)
This commit is contained in:
parent
a9d58feccf
commit
2c7d2e8d46
4 changed files with 15 additions and 2 deletions
|
@ -771,6 +771,15 @@ class AST_Tests(unittest.TestCase):
|
|||
with self.assertRaises(SyntaxError):
|
||||
ast.parse('(x := 0)', feature_version=(3, 7))
|
||||
|
||||
def test_exception_groups_feature_version(self):
|
||||
code = dedent('''
|
||||
try: ...
|
||||
except* Exception: ...
|
||||
''')
|
||||
ast.parse(code)
|
||||
with self.assertRaises(SyntaxError):
|
||||
ast.parse(code, feature_version=(3, 10))
|
||||
|
||||
def test_invalid_major_feature_version(self):
|
||||
with self.assertRaises(ValueError):
|
||||
ast.parse('pass', feature_version=(2, 7))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue