diff --git a/test/completion/basic.py b/test/completion/basic.py index d5457ea5..b18c58ac 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -232,6 +232,7 @@ def a(): #? # str literals in comment """ upper +# python >= 3.11 def completion_in_comment(): #? ['Exception', 'ExceptionGroup'] # might fail because the comment is not a leaf: Exception diff --git a/test/completion/completion.py b/test/completion/completion.py index f0dcb18a..b005e956 100644 --- a/test/completion/completion.py +++ b/test/completion/completion.py @@ -31,6 +31,7 @@ if x: #? ['else'] else +# python >= 3.11 try: pass #? ['except', 'Exception', 'ExceptionGroup'] diff --git a/test/completion/fstring.py b/test/completion/fstring.py index 59fe5f6e..8aaed5e9 100644 --- a/test/completion/fstring.py +++ b/test/completion/fstring.py @@ -1,3 +1,4 @@ +# python >= 3.11 class Foo: bar = 1 diff --git a/test/completion/keywords.py b/test/completion/keywords.py index 1c885e7e..5f0d396a 100644 --- a/test/completion/keywords.py +++ b/test/completion/keywords.py @@ -2,6 +2,7 @@ #? ['raise'] raise +# python >= 3.11 #? ['Exception', 'ExceptionGroup'] except diff --git a/test/completion/named_param.py b/test/completion/named_param.py index ef659574..521144fc 100644 --- a/test/completion/named_param.py +++ b/test/completion/named_param.py @@ -108,6 +108,8 @@ def z(bam, bar=2, *, bas=1): #? 7 ['bar=', 'baz='] x(1, ba) +# python >= 3.11 + #? 14 ['baz='] x(1, bar=2, ba) #? 7 ['bar=', 'baz='] diff --git a/test/completion/pep0484_typing.py b/test/completion/pep0484_typing.py index d0deba0f..c066e753 100644 --- a/test/completion/pep0484_typing.py +++ b/test/completion/pep0484_typing.py @@ -583,6 +583,7 @@ b = Builder() b.add_x(2) #? Builder() b.add_x(2).add_y(5) +# python >= 3.11 #? Builder() b.add_x(2).add_not_implemented(5) #? Builder() diff --git a/test/completion/types.py b/test/completion/types.py index f68ba0d6..77f2dd0c 100644 --- a/test/completion/types.py +++ b/test/completion/types.py @@ -2,6 +2,7 @@ # non array # ----------------- +# python >= 3.12 #? ['imag'] int.imag diff --git a/test/test_api/test_classes.py b/test/test_api/test_classes.py index b699d752..3b89feec 100644 --- a/test/test_api/test_classes.py +++ b/test/test_api/test_classes.py @@ -188,11 +188,15 @@ def test_functions_should_have_params(Script): assert c.get_signatures() -def test_hashlib_params(Script): +def test_hashlib_params(Script, environment): script = Script('from hashlib import sha256') c, = script.complete() sig, = c.get_signatures() - assert [p.name for p in sig.params] == ['data', 'usedforsecurity', 'string'] + if environment.version_info >= (3, 13): + wanted = ['data', 'usedforsecurity', 'string'] + else: + wanted = ['string', 'usedforsecurity'] + assert [p.name for p in sig.params] == wanted def test_signature_params(Script):