Exemplo n.º 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'))
Exemplo n.º 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
Exemplo n.º 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'))
Exemplo n.º 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
Exemplo n.º 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"))
Exemplo n.º 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'))
Exemplo n.º 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"))
Exemplo n.º 8
0
 def __call__(self, context):
     self.context = context
     vocab = ContactsVocabulary.create_with_provider(
         self.key_value_provider)
     return vocab
Exemplo n.º 9
0
    def test_custom_search_is_not_fuzzy(self):
        vocabulary = ContactsVocabulary.create_with_provider(
            self.key_value_provider)

        self.assertTermKeys([], vocabulary.search('firt'))
Exemplo n.º 10
0
 def __call__(self, context):
     self.context = context
     vocab = ContactsVocabulary.create_with_provider(
         self.key_value_provider)
     return vocab
Exemplo n.º 11
0
    def test_custom_search_is_not_fuzzy(self):
        vocabulary = ContactsVocabulary.create_with_provider(self.key_value_provider)

        self.assertTermKeys([], vocabulary.search('firt'))
Exemplo n.º 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'))
Exemplo n.º 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'))