Пример #1
0
    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'))
Пример #2
0
 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
Пример #3
0
    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'))
Пример #4
0
 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
Пример #5
0
    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"))
Пример #6
0
    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'))
Пример #7
0
    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"))
Пример #8
0
 def __call__(self, context):
     self.context = context
     vocab = ContactsVocabulary.create_with_provider(
         self.key_value_provider)
     return vocab
Пример #9
0
    def test_custom_search_is_not_fuzzy(self):
        vocabulary = ContactsVocabulary.create_with_provider(
            self.key_value_provider)

        self.assertTermKeys([], vocabulary.search('firt'))
Пример #10
0
 def __call__(self, context):
     self.context = context
     vocab = ContactsVocabulary.create_with_provider(
         self.key_value_provider)
     return vocab
Пример #11
0
    def test_custom_search_is_not_fuzzy(self):
        vocabulary = ContactsVocabulary.create_with_provider(self.key_value_provider)

        self.assertTermKeys([], vocabulary.search('firt'))
Пример #12
0
    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'))
Пример #13
0
    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'))