コード例 #1
0
 def test_unicode(self):
     text = u'Hellø world'
     self.assertEqual(
         c2h.highlight_text(u'lø', text),
         u'Hel<mark>lø</mark> world',
     )
コード例 #2
0
 def test_markup(self):
     text = 'Hello &amp; goodbye'
     self.assertEqual(
         c2h.highlight_text('lo & goo', text),
         'Hel<mark>lo &amp; goo</mark>dbye',
     )
コード例 #3
0
 def test_link(self):
     text = '<a href="https://example.com/">https://example.com/'
     self.assertEqual(
         c2h.highlight_text('example', text),
         '<a href="https://example.com/">https://<mark>example</mark>.com/',
     )
コード例 #4
0
 def test(self):
     text = 'Hello world'
     self.assertEqual(
         c2h.highlight_text('lo', text),
         'Hel<mark>lo</mark> world',
     )
コード例 #5
0
 def test_case_insensitive(self):
     text = 'HelLo world'
     self.assertEqual(
         c2h.highlight_text('lo', text),
         'Hel<mark>Lo</mark> world',
     )
コード例 #6
0
 def test_unicode(self):
     text = u'Hellø world'
     self.assertEqual(
         c2h.highlight_text(u'lø', text),
         u'Hel<mark>lø</mark> world',
     )
コード例 #7
0
 def test_link(self):
     text = '<a href="https://example.com/">https://example.com/'
     self.assertEqual(
         c2h.highlight_text('example', text),
         '<a href="https://example.com/">https://<mark>example</mark>.com/',
     )
コード例 #8
0
 def test_markup(self):
     text = 'Hello &amp; goodbye'
     self.assertEqual(
         c2h.highlight_text('lo & goo', text),
         'Hel<mark>lo &amp; goo</mark>dbye',
     )
コード例 #9
0
 def test_case_insensitive(self):
     text = 'HelLo world'
     self.assertEqual(
         c2h.highlight_text('lo', text),
         'Hel<mark>Lo</mark> world',
     )
コード例 #10
0
 def test(self):
     text = 'Hello world'
     self.assertEqual(
         c2h.highlight_text('lo', text),
         'Hel<mark>lo</mark> world',
     )