@@ -738,6 +738,14 @@ def test_ast_asdl_signature(self):
738
738
expressions [0 ] = f"expr = { ast .expr .__subclasses__ ()[0 ].__doc__ } "
739
739
self .assertCountEqual (ast .expr .__doc__ .split ("\n " ), expressions )
740
740
741
+ def test_positional_only_feature_version (self ):
742
+ ast .parse ('def foo(x, /): ...' , feature_version = (3 , 8 ))
743
+ ast .parse ('def bar(x=1, /): ...' , feature_version = (3 , 8 ))
744
+ with self .assertRaises (SyntaxError ):
745
+ ast .parse ('def foo(x, /): ...' , feature_version = (3 , 7 ))
746
+ with self .assertRaises (SyntaxError ):
747
+ ast .parse ('def bar(x=1, /): ...' , feature_version = (3 , 7 ))
748
+
741
749
def test_parenthesized_with_feature_version (self ):
742
750
ast .parse ('with (CtxManager() as example): ...' , feature_version = (3 , 10 ))
743
751
# While advertised as a feature in Python 3.10, this was allowed starting 3.9
@@ -746,7 +754,7 @@ def test_parenthesized_with_feature_version(self):
746
754
ast .parse ('with (CtxManager() as example): ...' , feature_version = (3 , 8 ))
747
755
ast .parse ('with CtxManager() as example: ...' , feature_version = (3 , 8 ))
748
756
749
- def test_issue40614_feature_version (self ):
757
+ def test_debug_f_string_feature_version (self ):
750
758
ast .parse ('f"{x=}"' , feature_version = (3 , 8 ))
751
759
with self .assertRaises (SyntaxError ):
752
760
ast .parse ('f"{x=}"' , feature_version = (3 , 7 ))
0 commit comments