Exemplo n.º 1
0
 def test_highlight_multi_token_wildcard(self):
     hl = highlight("testing1, testing2, nottesting", "test%", wildcard='%', delim=', ')
     expected = "%s, %s, nottesting" % (self.expectedHighlight("testing1"), 
                                        self.expectedHighlight("testing2"))
     self.assertEquals(expected, hl)
Exemplo n.º 2
0
 def test_highlight_complex_wildcard(self):
     hl = highlight("testing123456789", "%es%ing123%8%", wildcard='%')
     expected = self.expectedHighlight("testing123456789")
     self.assertEquals(expected, hl)
Exemplo n.º 3
0
 def test_highlight_match_in_list(self):
     hl = highlight("test1, test2, test3", "test2", delim=', ')
     expected = "test1, %s, test3" % (self.expectedHighlight("test2"))
     self.assertEquals(expected, hl)
Exemplo n.º 4
0
 def test_highlight_wildcard_in_middle(self):
     hl = highlight("testing", "t%ing", wildcard='%')
     expected = self.expectedHighlight("testing")
     self.assertEquals(expected, hl)
Exemplo n.º 5
0
 def test_highlight_phrase_in_many(self):
     hl = highlight("test1 test2 test3", "test2 test3", delim=None)
     expected = "test1 test2 test3"
     self.assertEquals(expected, hl)
Exemplo n.º 6
0
 def test_highlight_many_word_match(self):
     hl = highlight("test1 test2 test3", "test1 test2 test3", delim=None)
     expected = (self.expectedHighlight("test1 test2 test3"))
     self.assertEquals(expected, hl)
Exemplo n.º 7
0
 def test_highlight_one_word_match(self):
     hl = highlight("test", "test")
     expected = self.expectedHighlight("test")
     self.assertEquals(expected, hl)
Exemplo n.º 8
0
 def test_highlight_empty(self):
     self.assertEquals("test", highlight("test",""))