summaryrefslogtreecommitdiff
path: root/Lib/test/test_ast.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r--Lib/test/test_ast.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index de34ccff2e..2f3e9d5019 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -738,6 +738,14 @@ class AST_Tests(unittest.TestCase):
expressions[0] = f"expr = {ast.expr.__subclasses__()[0].__doc__}"
self.assertCountEqual(ast.expr.__doc__.split("\n"), expressions)
+ def test_positional_only_feature_version(self):
+ ast.parse('def foo(x, /): ...', feature_version=(3, 8))
+ ast.parse('def bar(x=1, /): ...', feature_version=(3, 8))
+ with self.assertRaises(SyntaxError):
+ ast.parse('def foo(x, /): ...', feature_version=(3, 7))
+ with self.assertRaises(SyntaxError):
+ ast.parse('def bar(x=1, /): ...', feature_version=(3, 7))
+
def test_parenthesized_with_feature_version(self):
ast.parse('with (CtxManager() as example): ...', feature_version=(3, 10))
# While advertised as a feature in Python 3.10, this was allowed starting 3.9
@@ -746,7 +754,7 @@ class AST_Tests(unittest.TestCase):
ast.parse('with (CtxManager() as example): ...', feature_version=(3, 8))
ast.parse('with CtxManager() as example: ...', feature_version=(3, 8))
- def test_issue40614_feature_version(self):
+ def test_debug_f_string_feature_version(self):
ast.parse('f"{x=}"', feature_version=(3, 8))
with self.assertRaises(SyntaxError):
ast.parse('f"{x=}"', feature_version=(3, 7))