示例#1
0
 def test_immutable_info(self, word):
     auto_complete = AutoComplete(words=SHORT_WORDS, synonyms=SYNONYMS)
     auto_complete_immutable = AutoComplete(
         words=SHORT_WORDS_IMMUTABLE_INFO, synonyms=SYNONYMS)
     search_results = auto_complete._find(word, max_cost=3, size=3)
     search_results_immutable = auto_complete_immutable._find(word,
                                                              max_cost=3,
                                                              size=3)
     print_results(locals())
     assert search_results_immutable == search_results
示例#2
0
 def test_search_without_synonyms(self, word, max_cost, size,
                                  expected_results):
     auto_complete = AutoComplete(words=WIKIPEDIA_WORDS)
     results, find_steps = auto_complete._find(word, max_cost, size)
     results = dict(results)
     print_results(locals())
     assert expected_results == results
示例#3
0
 def test_find(self, word, max_cost, size, expected_find_results,
               expected_steps, expected_find_and_sort_results):
     expected_results = expected_find_results
     auto_complete = AutoComplete(words=WIKIPEDIA_WORDS, synonyms=SYNONYMS)
     results, find_steps = auto_complete._find(word, max_cost, size)
     results = dict(results)
     print_results(locals())
     assert expected_results == results
     assert expected_steps == find_steps
示例#4
0
 def test_search_unicode_without_synonyms(self, word, max_cost, size,
                                          expected_results):
     auto_complete = AutoComplete(
         words=SHORT_WORDS_UNICODE,
         valid_chars_for_string='اآبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی')
     results, find_steps = auto_complete._find(word, max_cost, size)
     results = dict(results)
     print_results(locals())
     assert expected_results == results