From 99b5272d9a17ffd813fc8c0b2f3cae3201d2398e Mon Sep 17 00:00:00 2001 From: ahmad-alkadri Date: Sun, 15 Jan 2023 15:08:11 +0000 Subject: A little fix and modified the testing for content highlight --- tests/unit/test_webutils.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/unit/test_webutils.py b/tests/unit/test_webutils.py index 31a0f86ce..acf1aeeb7 100644 --- a/tests/unit/test_webutils.py +++ b/tests/unit/test_webutils.py @@ -28,32 +28,33 @@ class TestWebUtils(SearxTestCase): content = 'a' query = 'test' - self.assertEqual(webutils.highlight_content(content, query), content) + self.assertEqual(webutils.highlight_content(content, query), 'a') query = 'a test' - self.assertEqual(webutils.highlight_content(content, query), content) + self.assertEqual(webutils.highlight_content(content, query), 'a') data = ( ('" test "', 'a test string', 'a test string'), - ('"a"', 'this is a test string', 'this is a test string'), + ('"a"', 'this is a test string', 'this is a test string'), ( 'a test', 'this is a test string that matches entire query', - 'this is a test string that matches entire query', + 'this is a test string that matches entire query', ), ( 'this a test', 'this is a string to test.', ( - 'this is a ' - 'string to test.' + 'this is a string to test.' ), ), ( 'match this "exact phrase"', 'this string contains the exact phrase we want to match', - ( - 'this string contains the exact' - ' phrase we want to match' + ''.join( + [ + 'this string contains the exact ', + 'phrase we want to match', + ] ), ), ) -- cgit v1.2.3