Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions test/pytests/test_sqlcompleter.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,28 @@ def test_find_fuzzy_matches_appends_rapidfuzz_results_and_skips_duplicates(monke
]


@pytest.mark.parametrize('existing_fuzziness', [Fuzziness.PERFECT, Fuzziness.CAMEL_CASE, Fuzziness.RAPIDFUZZ])
def test_find_fuzzy_matches_skips_rapidfuzz_duplicates_for_remaining_fuzziness_types(
monkeypatch,
existing_fuzziness: Fuzziness,
) -> None:
monkeypatch.setattr(
SQLCompleter,
'find_fuzzy_match',
lambda self, item, pattern, under_words_text, case_words_text: existing_fuzziness if item == 'alphabet' else None,
)
monkeypatch.setattr(
mycli.sqlcompleter.rapidfuzz.process,
'extract',
lambda *args, **kwargs: [('alphabet', 95, 0)],
)
completer = SQLCompleter()

matches = completer.find_fuzzy_matches('alpahet', 'alpahet', ['alphabet'])

assert matches == [('alphabet', existing_fuzziness)]


@pytest.mark.parametrize(
('text', 'collection', 'start_only', 'expected'),
[
Expand Down
Loading