@@ -34,6 +34,28 @@ class TestWebUtils(SearxTestCase):
34 query = 'a test'
34 query = 'a test'
35 self.assertEqual(webutils.highlight_content(content, query), content)
35 self.assertEqual(webutils.highlight_content(content, query), content)
40+ 'a <span class="highlight">test</span> string'),
42+ 'this is a test string',
43+ 'this is<span class="highlight"> a </span>test string'),
45+ 'this is a test string that matches entire query',
46+ 'this is <span class="highlight">a test</span> string that matches entire query'),
48+ 'this is a string to test.',
49+ ('<span class="highlight">this</span> is<span class="highlight"> a </span>'
50+ 'string to <span class="highlight">test</span>.')),
51+ ('match this "exact phrase"',
52+ 'this string contains the exact phrase we want to match',
53+ ('<span class="highlight">this</span> string contains the <span class="highlight">exact</span>'
54+ ' <span class="highlight">phrase</span> we want to <span class="highlight">match</span>'))
56+ for query, content, expected in data:
57+ self.assertEqual(webutils.highlight_content(content, query), expected)
38class TestUnicodeWriter(SearxTestCase):
60class TestUnicodeWriter(SearxTestCase):