def _helper_completion_tests(self, result_list, **isolation_args): with self._helper_isolate_dict_matches(**isolation_args) as ( vim_mock, produce_mock): localcomplete.complete_dictionary_matches() produce_mock.assert_called_once_with(result_list, mock.ANY) vim_mock.command.assert_called_once_with(mock.ANY)
def _helper_completion_tests(self, result_list, **isolation_args): with self._helper_isolate_dict_matches( **isolation_args) as (vim_mock, produce_mock): localcomplete.complete_dictionary_matches() produce_mock.assert_called_once_with(result_list, mock.ANY) vim_mock.command.assert_called_once_with(mock.ANY)
def test_invalid_dictionary_path_results_in_no_matches(self): with self._helper_isolate_dict_matches( dict_content=u" priory prize none Priority primary ", keyword_base="pri", is_dictionary_path_valid=False) as (vim_mock, produce_mock): localcomplete.complete_dictionary_matches() produce_mock.assert_called_once_with([], mock.ANY) self.assertEqual(vim_mock.command.call_count, 2)
def test_invalid_dictionary_path_results_in_no_matches(self): with self._helper_isolate_dict_matches( dict_content=u" priory prize none Priority primary ", keyword_base="pri", is_dictionary_path_valid=False ) as (vim_mock, produce_mock): localcomplete.complete_dictionary_matches() produce_mock.assert_called_once_with([], mock.ANY) self.assertEqual(vim_mock.command.call_count, 2)
def test_case_insensitive_search_with_infercase(self): produce_mock = mock.Mock(spec_set=[], return_value=[]) with mock.patch.multiple(__name__ + ".localcomplete", produce_result_value=produce_mock): with self._helper_isolate_sut( dict_content=u"priory PRIze none Priority prIMary", keyword_base="PrI", want_ignorecase_dict=1 ) as vim_mock: localcomplete.complete_dictionary_matches() result_list = u"PrIory PrIze PrIority PrIMary".split() produce_mock.assert_called_once_with(result_list, mock.ANY) self.assertEqual(vim_mock.command.call_count, 1)
def test_standard_case_sensitive_search(self): produce_mock = mock.Mock(spec_set=[], return_value=[]) with mock.patch.multiple(__name__ + '.localcomplete', produce_result_value=produce_mock): with self._helper_isolate_sut( dict_content=u"priory prize none Priority primary", keyword_base="pri") as vim_mock: localcomplete.complete_dictionary_matches() result_list = u"priory prize primary".split() produce_mock.assert_called_once_with(result_list, mock.ANY) self.assertEqual(vim_mock.command.call_count, 1)