forked from VimPlug/jedi
Cleanup fuzzy tests a bit, see #1409
This commit is contained in:
2
setup.py
2
setup.py
@@ -38,7 +38,7 @@ setup(name='jedi',
|
|||||||
extras_require={
|
extras_require={
|
||||||
'testing': [
|
'testing': [
|
||||||
# Pytest 5 doesn't support Python 2 and Python 3.4 anymore.
|
# Pytest 5 doesn't support Python 2 and Python 3.4 anymore.
|
||||||
'pytest>=3.1.0,<5.0.0',
|
'pytest>=3.9.0,<5.0.0',
|
||||||
# docopt for sith doctests
|
# docopt for sith doctests
|
||||||
'docopt',
|
'docopt',
|
||||||
# coloroma for colored debug output
|
# coloroma for colored debug output
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from parso import cache
|
|||||||
from jedi._compatibility import unicode
|
from jedi._compatibility import unicode
|
||||||
from jedi import preload_module
|
from jedi import preload_module
|
||||||
from jedi.inference.gradual import typeshed
|
from jedi.inference.gradual import typeshed
|
||||||
|
from test.helpers import test_dir
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, EoL")
|
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, EoL")
|
||||||
@@ -325,43 +326,16 @@ def test_fuzzy_completion(Script):
|
|||||||
'upper'] == [comp.name for comp in script.completions(fuzzy=True)]
|
'upper'] == [comp.name for comp in script.completions(fuzzy=True)]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 3),
|
def test_math_fuzzy_completion(Script, environment):
|
||||||
reason="requires python3.3 or higher")
|
|
||||||
def test_math_fuzzy_completion(Script):
|
|
||||||
script = Script('import math\nmath.og')
|
script = Script('import math\nmath.og')
|
||||||
assert ['copysign', 'log', 'log10', 'log1p',
|
expected = ['copysign', 'log', 'log10', 'log1p']
|
||||||
'log2'] == [comp.name for comp in script.completions(fuzzy=True)]
|
if environment.version_info.major >= 3:
|
||||||
|
expected.append('log2')
|
||||||
|
assert expected == [comp.name for comp in script.completions(fuzzy=True)]
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 3),
|
|
||||||
reason="requires python3.3 or higher")
|
def test_file_fuzzy_completion(Script):
|
||||||
def test_file_fuzzy_completion(Script, tmp_path):
|
path = os.path.join(test_dir, 'completion')
|
||||||
folder0 = tmp_path / "inference"
|
script = Script('"{}/ep08_i'.format(path))
|
||||||
folder0.mkdir()
|
assert ['pep0484_basic.py"', 'pep0484_typing.py"'] \
|
||||||
file0_path0 = folder0 / "sys_path.py"
|
|
||||||
file0_path0.write_text('\n')
|
|
||||||
file0_path1 = folder0 / "syntax_tree.py"
|
|
||||||
file0_path1.write_text('\n')
|
|
||||||
script = Script('"{}/yt'.format(folder0))
|
|
||||||
assert ['syntax_tree.py"', 'sys_path.py"'] \
|
|
||||||
== [comp.name for comp in script.completions(fuzzy=True)]
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info > (2, 7),
|
|
||||||
reason="requires python3.3 or higher")
|
|
||||||
def test_math_fuzzy_completion(Script):
|
|
||||||
script = Script('import math\nmath.og')
|
|
||||||
assert ['copysign', 'log', 'log10',
|
|
||||||
'log1p'] == [comp.name for comp in script.completions(fuzzy=True)]
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info > (2, 7),
|
|
||||||
reason="requires python3.3 or higher")
|
|
||||||
def test_file_fuzzy_completion(Script, tmp_path):
|
|
||||||
folder0 = tmp_path / u"inference"
|
|
||||||
folder0.mkdir()
|
|
||||||
file0_path0 = folder0 / u"sys_path.py"
|
|
||||||
file0_path0.write_text('\n')
|
|
||||||
file0_path1 = folder0 / u"syntax_tree.py"
|
|
||||||
file0_path1.write_text('\n')
|
|
||||||
script = Script('"{}/yt'.format(folder0))
|
|
||||||
assert ['syntax_tree.py"', 'sys_path.py"'] \
|
|
||||||
== [comp.name for comp in script.completions(fuzzy=True)]
|
== [comp.name for comp in script.completions(fuzzy=True)]
|
||||||
|
|||||||
Reference in New Issue
Block a user