mirror of
https://github.com/searxng/searxng.git
synced 2025-07-16 09:49:21 +02:00
[refactor] unit tests (continued) - plugins
This commit includes some refactoring in unit tests. As we test more plugins, it seems unweildy to include every test class in the test_plugins.py file. This patch split apart all of the test plugins to their own respective files, including the new test_plugin_calculator.py file.
This commit is contained in:
parent
8ba203c72b
commit
d448def1a6
5 changed files with 194 additions and 104 deletions
|
@ -1,16 +1,21 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# pylint: disable=missing-module-docstring, invalid-name
|
||||
|
||||
import random
|
||||
import string
|
||||
import lxml.etree
|
||||
from lxml import html
|
||||
from parameterized.parameterized import parameterized
|
||||
|
||||
from searx.exceptions import SearxXPathSyntaxException, SearxEngineXPathException
|
||||
from searx import utils
|
||||
|
||||
from tests import SearxTestCase
|
||||
|
||||
|
||||
def random_string(length, choices=string.ascii_letters):
|
||||
return ''.join(random.choice(choices) for _ in range(length))
|
||||
|
||||
|
||||
class TestUtils(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||
def test_gen_useragent(self):
|
||||
self.assertIsInstance(utils.gen_useragent(), str)
|
||||
|
@ -234,4 +239,4 @@ class TestXPathUtils(SearxTestCase): # pylint: disable=missing-class-docstring
|
|||
self.assertIsNone(l)
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
utils.detect_language(None)
|
||||
utils.detect_language(None) # type: ignore
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue