1
0
forked from VimPlug/jedi

Added file fuzzy match and refactored

This commit is contained in:
Johannes Maria Frank
2019-10-22 15:50:16 +01:00
parent 2653752f9c
commit f7fae4dde7
8 changed files with 44 additions and 23 deletions

View File

@@ -306,6 +306,18 @@ def test_goto_follow_builtin_imports(Script):
assert d.in_builtin_module() is True
def test_file_fuzzy_completion(Script, tmp_path):
folder0 = tmp_path / "inference"
folder0.mkdir()
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 ['sys_path.py"',
'syntax_tree.py"' ] == [comp.name for comp in script.completions(fuzzy=True)]
def test_fuzzy_completion(Script):
script = Script('string = "hello"\nstring.upper')
assert ['isupper',
@@ -325,4 +337,6 @@ def test_math_fuzzy_completion(Script):
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)]
'log1p'] == [comp.name for comp in script.completions(fuzzy=True)]

View File

@@ -268,7 +268,7 @@ def test_file_path_completions(Script, file, code, column, expected):
else:
assert [c.complete for c in comps] == expected
from jedi.api.completion import start_match, fuzzy_match
from jedi.api.helpers import start_match, fuzzy_match
def test_start_match():
assert start_match('Condition', 'C')