def test_custom_search_handle_each_word_seperatly(self): vocabulary = ContactsVocabulary.create_with_provider( self.key_value_provider) self.assertTermKeys(['first-entry'], vocabulary.search('fir en')) self.assertTermKeys(['first-entry'], vocabulary.search('en fir')) self.assertTermKeys(['third-entry'], vocabulary.search('ird'))
def __call__(self, context): self.context = context vocab = wrap_vocabulary( ContactsVocabulary.create_with_provider( self.key_value_provider))(context) vocab.hidden_terms = self.hidden_terms return vocab
def test_custom_search_is_case_insensitive(self): vocabulary = ContactsVocabulary.create_with_provider( self.key_value_provider) self.assertTermKeys([ 'first-entry', ], vocabulary.search('FIR EN'))
def test_unicode_handling_in_vocabulary_search(self): def key_value_provider(): yield (u'J\xf6rg R\xfctimann', u'j\xf6rg@r\xfctimann.\u0109h') vocabulary = ContactsVocabulary.create_with_provider( key_value_provider) self.assertTermKeys([u'J\xf6rg R\xfctimann'], vocabulary.search("j"))
def test_custom_search_can_handle_multiple_results(self): vocabulary = ContactsVocabulary.create_with_provider(self.key_value_provider) self.assertTermKeys( ['first-entry', 'second-entry', 'third-entry', 'fourth-entry', 'fifth-entry', ], vocabulary.search('entry')) self.assertTermKeys( ['first-entry', 'fifth-entry'], vocabulary.search('fi en'))
def test_unicode_handling_in_vocabulary_search(self): def key_value_provider(): yield (u'J\xf6rg R\xfctimann', u'j\xf6rg@r\xfctimann.\u0109h') vocabulary = ContactsVocabulary.create_with_provider(key_value_provider) self.assertTermKeys( [u'J\xf6rg R\xfctimann'], vocabulary.search("j"))
def __call__(self, context): self.context = context vocab = ContactsVocabulary.create_with_provider( self.key_value_provider) return vocab
def test_custom_search_is_not_fuzzy(self): vocabulary = ContactsVocabulary.create_with_provider( self.key_value_provider) self.assertTermKeys([], vocabulary.search('firt'))
def test_custom_search_is_not_fuzzy(self): vocabulary = ContactsVocabulary.create_with_provider(self.key_value_provider) self.assertTermKeys([], vocabulary.search('firt'))
def test_custom_search_is_case_insensitive(self): vocabulary = ContactsVocabulary.create_with_provider(self.key_value_provider) self.assertTermKeys(['first-entry', ], vocabulary.search('FIR EN'))
def test_custom_search_handle_each_word_seperatly(self): vocabulary = ContactsVocabulary.create_with_provider(self.key_value_provider) self.assertTermKeys(['first-entry'], vocabulary.search('fir en')) self.assertTermKeys(['first-entry'], vocabulary.search('en fir')) self.assertTermKeys(['third-entry'], vocabulary.search('ird'))