From 1022228d950c2a809ed613df1a515d9a6cafda7c Mon Sep 17 00:00:00 2001 From: Dalf Date: Thu, 6 Aug 2020 17:42:46 +0200 Subject: Drop Python 2 (1/n): remove unicode string and url_utils --- tests/unit/test_utils.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'tests/unit/test_utils.py') 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): """ - 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' -- cgit v1.2.3