mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
Drop redundant conditional skips for unsupported Python versions
This commit is contained in:
@@ -188,10 +188,7 @@ def test_functions_should_have_params(Script):
|
|||||||
assert c.get_signatures()
|
assert c.get_signatures()
|
||||||
|
|
||||||
|
|
||||||
def test_hashlib_params(Script, environment):
|
def test_hashlib_params(Script):
|
||||||
if environment.version_info < (3,):
|
|
||||||
pytest.skip()
|
|
||||||
|
|
||||||
script = Script('from hashlib import sha256')
|
script = Script('from hashlib import sha256')
|
||||||
c, = script.complete()
|
c, = script.complete()
|
||||||
sig, = c.get_signatures()
|
sig, = c.get_signatures()
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
import pytest
|
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
|
||||||
def skip_not_supported(environment):
|
|
||||||
if environment.version_info < (3, 6):
|
|
||||||
pytest.skip()
|
|
||||||
|
|
||||||
|
|
||||||
def test_fstring_multiline(Script):
|
def test_fstring_multiline(Script):
|
||||||
code = dedent("""\
|
code = dedent("""\
|
||||||
'' f'''s{
|
'' f'''s{
|
||||||
|
|||||||
@@ -12,29 +12,23 @@ def _infer_literal(Script, code, is_fstring=False):
|
|||||||
return def_._name._value.get_safe_value()
|
return def_._name._value.get_safe_value()
|
||||||
|
|
||||||
|
|
||||||
def test_f_strings(Script, environment):
|
def test_f_strings(Script):
|
||||||
"""
|
"""
|
||||||
f literals are not really supported in Jedi. They just get ignored and an
|
f literals are not really supported in Jedi. They just get ignored and an
|
||||||
empty string is returned.
|
empty string is returned.
|
||||||
"""
|
"""
|
||||||
if environment.version_info < (3, 6):
|
|
||||||
pytest.skip()
|
|
||||||
|
|
||||||
assert _infer_literal(Script, 'f"asdf"', is_fstring=True) == ''
|
assert _infer_literal(Script, 'f"asdf"', is_fstring=True) == ''
|
||||||
assert _infer_literal(Script, 'f"{asdf} "', is_fstring=True) == ''
|
assert _infer_literal(Script, 'f"{asdf} "', is_fstring=True) == ''
|
||||||
assert _infer_literal(Script, 'F"{asdf} "', is_fstring=True) == ''
|
assert _infer_literal(Script, 'F"{asdf} "', is_fstring=True) == ''
|
||||||
assert _infer_literal(Script, 'rF"{asdf} "', is_fstring=True) == ''
|
assert _infer_literal(Script, 'rF"{asdf} "', is_fstring=True) == ''
|
||||||
|
|
||||||
|
|
||||||
def test_rb_strings(Script, environment):
|
def test_rb_strings(Script):
|
||||||
assert _infer_literal(Script, 'x = br"asdf"; x') == b'asdf'
|
assert _infer_literal(Script, 'x = br"asdf"; x') == b'asdf'
|
||||||
assert _infer_literal(Script, 'x = rb"asdf"; x') == b'asdf'
|
assert _infer_literal(Script, 'x = rb"asdf"; x') == b'asdf'
|
||||||
|
|
||||||
|
|
||||||
def test_thousand_separators(Script, environment):
|
def test_thousand_separators(Script):
|
||||||
if environment.version_info < (3, 6):
|
|
||||||
pytest.skip()
|
|
||||||
|
|
||||||
assert _infer_literal(Script, '1_2_3') == 123
|
assert _infer_literal(Script, '1_2_3') == 123
|
||||||
assert _infer_literal(Script, '123_456_789') == 123456789
|
assert _infer_literal(Script, '123_456_789') == 123456789
|
||||||
assert _infer_literal(Script, '0x3_4') == 52
|
assert _infer_literal(Script, '0x3_4') == 52
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
from operator import ge, lt
|
from operator import ge
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -17,14 +17,10 @@ from ..helpers import get_example_dir
|
|||||||
|
|
||||||
('str', "str(object='', /) -> str", ['object'], ge, (3, 6)),
|
('str', "str(object='', /) -> str", ['object'], ge, (3, 6)),
|
||||||
|
|
||||||
('pow', 'pow(x, y, z=None, /) -> number', ['x', 'y', 'z'], lt, (3, 6)),
|
|
||||||
('pow', 'pow(base, exp, mod=None)', ['base', 'exp', 'mod'], ge, (3, 8)),
|
('pow', 'pow(base, exp, mod=None)', ['base', 'exp', 'mod'], ge, (3, 8)),
|
||||||
|
|
||||||
('bytes.partition', 'partition(self, sep, /) -> (head, sep, tail)',
|
|
||||||
['self', 'sep'], lt, (3, 6)),
|
|
||||||
('bytes.partition', 'partition(self, sep, /)', ['self', 'sep'], ge, (3, 6)),
|
('bytes.partition', 'partition(self, sep, /)', ['self', 'sep'], ge, (3, 6)),
|
||||||
|
|
||||||
('bytes().partition', 'partition(sep, /) -> (head, sep, tail)', ['sep'], lt, (3, 6)),
|
|
||||||
('bytes().partition', 'partition(sep, /)', ['sep'], ge, (3, 6)),
|
('bytes().partition', 'partition(sep, /)', ['sep'], ge, (3, 6)),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user