gh-95066: ast: Replace assert with ValueError (GH-95072) · python/cpython@a5dde0f · GitHub
Skip to content

Commit a5dde0f

Browse files
gh-95066: ast: Replace assert with ValueError (GH-95072)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
1 parent 0d35a59 commit a5dde0f

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

Lib/ast.py

Lines changed: 2 additions & 1 deletion

Lib/test/test_ast.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,12 @@ def test_assignment_expression_feature_version(self):
756756
with self.assertRaises(SyntaxError):
757757
ast.parse('(x := 0)', feature_version=(3, 7))
758758

759+
def test_invalid_major_feature_version(self):
760+
with self.assertRaises(ValueError):
761+
ast.parse('pass', feature_version=(2, 7))
762+
with self.assertRaises(ValueError):
763+
ast.parse('pass', feature_version=(4, 0))
764+
759765
def test_constant_as_name(self):
760766
for constant in "True", "False", "None":
761767
expr = ast.Expression(ast.Name(constant, ast.Load()))
Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)