From 09737930b566df89e2dfcf632ef6a36a440d5dae Mon Sep 17 00:00:00 2001 From: Adrien Perrin Date: Mon, 7 Oct 2024 09:32:18 +0000 Subject: [PATCH] add test for cf vocabulary fuzzy search --- pythesint/tests/test_cf_vocabulary.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pythesint/tests/test_cf_vocabulary.py b/pythesint/tests/test_cf_vocabulary.py index 485cde6..dc90aa9 100644 --- a/pythesint/tests/test_cf_vocabulary.py +++ b/pythesint/tests/test_cf_vocabulary.py @@ -3,7 +3,7 @@ import mock.mock as mock import requests -from pythesint.cf_vocabulary import CFVocabulary +from pythesint.cf_vocabulary import CFVocabulary, ratio class CFVocabularyTest(unittest.TestCase): def test_exception_on_unavailable_remote_file(self): @@ -34,3 +34,12 @@ def test_fetch_version(self): voc._fetch_online_data(version='9.1.5') mock_get.assert_called_with( 'https://sdfghdfghd.nersc.no', params={'version': '9.1.5'}) + + def test_fuzzy_search(self): + """Test that _fuzzy_search is called with the altered parameters + """ + vocabulary = CFVocabulary('test') + with mock.patch.object(vocabulary, '_fuzzy_search') as mock_fuzzy_search: + vocabulary.fuzzy_search('foo') + mock_fuzzy_search.assert_called_once_with( + 'foo', scorer=ratio, results_limit=10, min_score=90.0)