diff options
Diffstat (limited to 'tests/unit/test_utils.py')
| -rw-r--r-- | tests/unit/test_utils.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index b09b9d414..f7fc7c0e4 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -1,12 +1,8 @@ # -*- coding: utf-8 -*- import mock -import sys from searx.testing import SearxTestCase from searx import utils -if sys.version_info[0] == 3: - unicode = str - class TestUtils(SearxTestCase): @@ -52,15 +48,15 @@ class TestUtils(SearxTestCase): </span> </a> """ - self.assertIsInstance(utils.html_to_text(html), unicode) + self.assertIsInstance(utils.html_to_text(html), str) self.assertIsNotNone(utils.html_to_text(html)) self.assertEqual(utils.html_to_text(html), "Test text") def test_prettify_url(self): data = (('https://searx.me/', 'https://searx.me/'), - (u'https://searx.me/ű', u'https://searx.me/ű'), + ('https://searx.me/ű', 'https://searx.me/ű'), ('https://searx.me/' + (100 * 'a'), 'https://searx.me/[...]aaaaaaaaaaaaaaaaa'), - (u'https://searx.me/' + (100 * u'ű'), u'https://searx.me/[...]űűűűűűűűűűűűűűűűű')) + ('https://searx.me/' + (100 * 'ű'), 'https://searx.me/[...]űűűűűűűűűűűűűűűűű')) for test_url, expected in data: self.assertEqual(utils.prettify_url(test_url, max_length=32), expected) @@ -108,12 +104,12 @@ class TestHTMLTextExtractor(SearxTestCase): def test_handle_charref(self): self.html_text_extractor.handle_charref('xF') - self.assertIn(u'\x0f', self.html_text_extractor.result) + self.assertIn('\x0f', self.html_text_extractor.result) self.html_text_extractor.handle_charref('XF') - self.assertIn(u'\x0f', self.html_text_extractor.result) + self.assertIn('\x0f', self.html_text_extractor.result) self.html_text_extractor.handle_charref('97') - self.assertIn(u'a', self.html_text_extractor.result) + self.assertIn('a', self.html_text_extractor.result) def test_handle_entityref(self): entity = 'test' |