Added experimental substring and fuzzysearch

This commit is contained in:
Johannes Maria Frank
2019-09-26 08:17:30 +01:00
parent a6fcf779d4
commit 8f306953da
2 changed files with 32 additions and 1 deletions

View File

@@ -267,3 +267,18 @@ def test_file_path_completions(Script, file, code, column, expected):
assert len(comps) > 100 # This is basically global completions.
else:
assert [c.complete for c in comps] == expected
from jedi.api.completion import start_match, substr_match, fuzzy_match
def test_start_match():
assert start_match('Condition', 'C')
def test_substr_match():
assert substr_match('Condition', 'dit')
def test_fuzzy_match():
assert fuzzy_match('Condition', 'i')
assert not fuzzy_match('Condition', 'p')
assert fuzzy_match('Condition', 'ii')
assert not fuzzy_match('Condition', 'Ciito')
assert fuzzy_match('Condition', 'Cdiio')