From 542f7d0d7bd1a12e1884ba4a1508b40e2514d472 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 11 Mar 2024 14:06:26 +0100 Subject: [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 --- tests/unit/test_utils.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'tests/unit/test_utils.py') 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 = '

Lorem ipsumdolor sit amet

' - self.assertEqual(utils.html_to_text(html), "Lorem ipsum") + _html = '

Lorem ipsumdolor sit amet

' + 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 = '

Lorem ipsumdolor sit amet

' - 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 = """
  • Text in bold and italic
  • -- cgit v1.2.3