Skip to content

Commit

Permalink
add test for cf vocabulary fuzzy search
Browse files Browse the repository at this point in the history
  • Loading branch information
aperrin66 committed Oct 7, 2024
1 parent 971b8ec commit f447e84
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pythesint/tests/test_cf_vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

0 comments on commit f447e84

Please sign in to comment.