1
0
forked from VimPlug/jedi

Implement Script.complete_search instead of the complete param and return Completion objects

This commit is contained in:
Dave Halter
2020-03-09 23:55:17 +01:00
parent cf3d83ee4f
commit d838eaecd2
3 changed files with 35 additions and 8 deletions

View File

@@ -69,6 +69,24 @@ def test_simple_search(Script, string, descriptions, kwargs, skip_pre_python36):
if sys.version_info < (3, 6):
pytest.skip()
defs = Script(path=__file__).search(string, **kwargs)
if kwargs.pop('complete', False) is True:
defs = Script(path=__file__).complete_search(string, **kwargs)
else:
defs = Script(path=__file__).search(string, **kwargs)
this_mod = 'test.test_api.test_search.'
assert [d.type + ' ' + d.full_name.replace(this_mod, '') for d in defs] == descriptions
@pytest.mark.parametrize(
'string, completions, fuzzy, all_scopes', [
('SomeCl', ['ass'], False, False),
('SomeCl', [None], True, False),
('twic', [], False, False),
('some_f', [], False, False),
('twic', ['e', 'e'], False, True),
('some_f', ['unction'], False, True),
]
)
def test_complete_search(Script, string, completions, fuzzy, all_scopes):
defs = Script(path=__file__).complete_search(string, fuzzy=fuzzy, all_scopes=all_scopes)
assert [d.complete for d in defs] == completions