summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ast.py
diff options
context:
space:
mode:
authorShantanu <12621235+hauntsaninja@users.noreply.github.com>2022-07-26 09:43:09 (GMT)
committerGitHub <noreply@github.com>2022-07-26 09:43:09 (GMT)
commita5dde0fe4fa13b4ccfec4e27502b19bbbb7e5bb0 (patch)
treecd0b888ed9904ebd0ac665125a5aae9e6aa0a027 /Lib/test/test_ast.py
parent0d35a59ce3242b7326890a8c8cc41b321192ec9a (diff)
downloadcpython-a5dde0fe4fa13b4ccfec4e27502b19bbbb7e5bb0.zip
cpython-a5dde0fe4fa13b4ccfec4e27502b19bbbb7e5bb0.tar.gz
cpython-a5dde0fe4fa13b4ccfec4e27502b19bbbb7e5bb0.tar.bz2
gh-95066: ast: Replace assert with ValueError (GH-95072)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r--Lib/test/test_ast.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index 9734218..de34ccf 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -756,6 +756,12 @@ class AST_Tests(unittest.TestCase):
with self.assertRaises(SyntaxError):
ast.parse('(x := 0)', feature_version=(3, 7))
+ def test_invalid_major_feature_version(self):
+ with self.assertRaises(ValueError):
+ ast.parse('pass', feature_version=(2, 7))
+ with self.assertRaises(ValueError):
+ ast.parse('pass', feature_version=(4, 0))
+
def test_constant_as_name(self):
for constant in "True", "False", "None":
expr = ast.Expression(ast.Name(constant, ast.Load()))