summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorGrant Lanham <contact@grantlanham.com>2024-09-23 23:37:30 -0400
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-10-03 13:20:32 +0200
commit44a06190bbb1b412f0ed16a76b0a4aeef80975b7 (patch)
treedd6e94d656fe4b11918e6cb5bd6183535dcc7254 /searx
parent042c7190e6fe092a8a85997713a2511fffb09625 (diff)
downloadsearxng-44a06190bbb1b412f0ed16a76b0a4aeef80975b7.tar.gz
searxng-44a06190bbb1b412f0ed16a76b0a4aeef80975b7.zip
[refactor] unit tests to utilize paramaterized and break down monolithic tests
- for tests which perform the same arrange/act/assert pattern but with different data, the data portion has been moved to the ``paramaterized.expand`` fields - for monolithic tests which performed multiple arrange/act/asserts, they have been broken up into different unit tests. - when possible, change generic assert statements to more concise asserts (i.e. ``assertIsNone``) This work ultimately is focused on creating smaller and more concise tests. While paramaterized may make adding new configurations for existing tests easier, that is just a beneficial side effect. The main benefit is that smaller tests are easier to reason about, meaning they are easier to debug when they start failing. This improves the developer experience in debugging what went wrong when refactoring the project. Total number of tests went from 192 -> 259; or, broke apart larger tests into 69 more concise ones.
Diffstat (limited to 'searx')
-rw-r--r--searx/query.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/searx/query.py b/searx/query.py
index ae68d0da2..aa4cb0bc9 100644
--- a/searx/query.py
+++ b/searx/query.py
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=invalid-name, missing-module-docstring, missing-class-docstring
+from __future__ import annotations
from abc import abstractmethod, ABC
import re
@@ -258,7 +259,7 @@ class RawTextQuery:
FeelingLuckyParser, # redirect to the first link in the results list
]
- def __init__(self, query, disabled_engines):
+ def __init__(self, query: str, disabled_engines: list):
assert isinstance(query, str)
# input parameters
self.query = query