summaryrefslogtreecommitdiff
path: root/tests/unit/test_utils.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2024-03-11 14:06:26 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-03-11 14:55:38 +0100
commit542f7d0d7bd1a12e1884ba4a1508b40e2514d472 (patch)
tree5256282b267e494200d02914593457854567fec4 /tests/unit/test_utils.py
parent8205f170ff983e5240d32dc17d7fdb526ebe5fe7 (diff)
downloadsearxng-542f7d0d7bd1a12e1884ba4a1508b40e2514d472.tar.gz
searxng-542f7d0d7bd1a12e1884ba4a1508b40e2514d472.zip
[mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTION
In the past, some files were tested with the standard profile, others with a profile in which most of the messages were switched off ... some files were not checked at all. - ``PYLINT_SEARXNG_DISABLE_OPTION`` has been abolished - the distinction ``# lint: pylint`` is no longer necessary - the pylint tasks have been reduced from three to two 1. ./searx/engines -> lint engines with additional builtins 2. ./searx ./searxng_extra ./tests -> lint all other python files Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'tests/unit/test_utils.py')
-rw-r--r--tests/unit/test_utils.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
index dcb2cb9f2..1a6fba46d 100644
--- a/tests/unit/test_utils.py
+++ b/tests/unit/test_utils.py
@@ -1,4 +1,6 @@
-# -*- coding: utf-8 -*-
+# SPDX-License-Identifier: AGPL-3.0-or-later
+# pylint: disable=missing-module-docstring, invalid-name
+
import lxml.etree
from lxml import html
@@ -8,7 +10,7 @@ from searx import utils
from tests import SearxTestCase
-class TestUtils(SearxTestCase):
+class TestUtils(SearxTestCase): # pylint: disable=missing-class-docstring
def test_gen_useragent(self):
self.assertIsInstance(utils.gen_useragent(), str)
self.assertIsNotNone(utils.gen_useragent())
@@ -85,8 +87,8 @@ class TestUtils(SearxTestCase):
utils.extract_url([], 'https://example.com')
def test_html_to_text_invalid(self):
- html = '<p><b>Lorem ipsum</i>dolor sit amet</p>'
- self.assertEqual(utils.html_to_text(html), "Lorem ipsum")
+ _html = '<p><b>Lorem ipsum</i>dolor sit amet</p>'
+ self.assertEqual(utils.html_to_text(_html), "Lorem ipsum")
def test_ecma_unscape(self):
self.assertEqual(utils.ecma_unescape('text%20with%20space'), 'text with space')
@@ -94,9 +96,9 @@ class TestUtils(SearxTestCase):
self.assertEqual(utils.ecma_unescape('text using %u: %u5409, %u4E16%u754c'), 'text using %u: 吉, δΈ–η•Œ')
-class TestHTMLTextExtractor(SearxTestCase):
+class TestHTMLTextExtractor(SearxTestCase): # pylint: disable=missing-class-docstring
def setUp(self):
- self.html_text_extractor = utils._HTMLTextExtractor()
+ self.html_text_extractor = utils._HTMLTextExtractor() # pylint: disable=protected-access
def test__init__(self):
self.assertEqual(self.html_text_extractor.result, [])
@@ -117,11 +119,11 @@ class TestHTMLTextExtractor(SearxTestCase):
def test_invalid_html(self):
text = '<p><b>Lorem ipsum</i>dolor sit amet</p>'
- with self.assertRaises(utils._HTMLTextExtractorException):
+ with self.assertRaises(utils._HTMLTextExtractorException): # pylint: disable=protected-access
self.html_text_extractor.feed(text)
-class TestXPathUtils(SearxTestCase):
+class TestXPathUtils(SearxTestCase): # pylint: disable=missing-class-docstring
TEST_DOC = """<ul>
<li>Text in <b>bold</b> and <i>italic</i> </li>