diff options
author | Alexandre Flament <alex@al-f.net> | 2020-12-17 13:51:57 +0100 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2020-12-18 12:29:48 +0100 |
commit | 995ba2f40643bd01134902eca91cacf0bab1ebdc (patch) | |
tree | 4e0a0095686d9e5193f7b5db168d87a65e9ddc41 /tests | |
parent | 14c7cc0e118f1d0873b32b34793cdec2c5c9c13e (diff) | |
download | searxng-995ba2f40643bd01134902eca91cacf0bab1ebdc.tar.gz searxng-995ba2f40643bd01134902eca91cacf0bab1ebdc.zip |
[mod] searx.search.SearchQuery: remove categories parameter
The categories parameter is useless in the constructor:
it is always the categories from the EngineRef.
The categories becomes a property.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/test_search.py | 22 | ||||
-rw-r--r-- | tests/unit/test_standalone_searx.py | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/tests/unit/test_search.py b/tests/unit/test_search.py index 9938a43a5..08b41e062 100644 --- a/tests/unit/test_search.py +++ b/tests/unit/test_search.py @@ -23,13 +23,13 @@ TEST_ENGINES = [ class SearchQueryTestCase(SearxTestCase): def test_repr(self): - s = SearchQuery('test', [EngineRef('bing', 'general', False)], ['general'], 'all', 0, 1, '1', 5.0, 'g') + s = SearchQuery('test', [EngineRef('bing', 'general', False)], 'all', 0, 1, '1', 5.0, 'g') self.assertEqual(repr(s), - "SearchQuery('test', [EngineRef('bing', 'general', False)], ['general'], 'all', 0, 1, '1', 5.0, 'g')") # noqa + "SearchQuery('test', [EngineRef('bing', 'general', False)], 'all', 0, 1, '1', 5.0, 'g')") # noqa def test_eq(self): - s = SearchQuery('test', [EngineRef('bing', 'general', False)], ['general'], 'all', 0, 1, None, None, None) - t = SearchQuery('test', [EngineRef('google', 'general', False)], ['general'], 'all', 0, 1, None, None, None) + s = SearchQuery('test', [EngineRef('bing', 'general', False)], 'all', 0, 1, None, None, None) + t = SearchQuery('test', [EngineRef('google', 'general', False)], 'all', 0, 1, None, None, None) self.assertEqual(s, s) self.assertNotEqual(s, t) @@ -43,7 +43,7 @@ class SearchTestCase(SearxTestCase): def test_timeout_simple(self): searx.search.max_request_timeout = None search_query = SearchQuery('test', [EngineRef(PUBLIC_ENGINE_NAME, 'general')], - ['general'], 'en-US', SAFESEARCH, PAGENO, None, None) + 'en-US', SAFESEARCH, PAGENO, None, None) search = searx.search.Search(search_query) search.search() self.assertEqual(search.actual_timeout, 3.0) @@ -51,7 +51,7 @@ class SearchTestCase(SearxTestCase): def test_timeout_query_above_default_nomax(self): searx.search.max_request_timeout = None search_query = SearchQuery('test', [EngineRef(PUBLIC_ENGINE_NAME, 'general')], - ['general'], 'en-US', SAFESEARCH, PAGENO, None, 5.0) + 'en-US', SAFESEARCH, PAGENO, None, 5.0) search = searx.search.Search(search_query) search.search() self.assertEqual(search.actual_timeout, 3.0) @@ -59,7 +59,7 @@ class SearchTestCase(SearxTestCase): def test_timeout_query_below_default_nomax(self): searx.search.max_request_timeout = None search_query = SearchQuery('test', [EngineRef(PUBLIC_ENGINE_NAME, 'general')], - ['general'], 'en-US', SAFESEARCH, PAGENO, None, 1.0) + 'en-US', SAFESEARCH, PAGENO, None, 1.0) search = searx.search.Search(search_query) search.search() self.assertEqual(search.actual_timeout, 1.0) @@ -67,7 +67,7 @@ class SearchTestCase(SearxTestCase): def test_timeout_query_below_max(self): searx.search.max_request_timeout = 10.0 search_query = SearchQuery('test', [EngineRef(PUBLIC_ENGINE_NAME, 'general')], - ['general'], 'en-US', SAFESEARCH, PAGENO, None, 5.0) + 'en-US', SAFESEARCH, PAGENO, None, 5.0) search = searx.search.Search(search_query) search.search() self.assertEqual(search.actual_timeout, 5.0) @@ -75,7 +75,7 @@ class SearchTestCase(SearxTestCase): def test_timeout_query_above_max(self): searx.search.max_request_timeout = 10.0 search_query = SearchQuery('test', [EngineRef(PUBLIC_ENGINE_NAME, 'general')], - ['general'], 'en-US', SAFESEARCH, PAGENO, None, 15.0) + 'en-US', SAFESEARCH, PAGENO, None, 15.0) search = searx.search.Search(search_query) search.search() self.assertEqual(search.actual_timeout, 10.0) @@ -83,7 +83,7 @@ class SearchTestCase(SearxTestCase): def test_external_bang(self): search_query = SearchQuery('yes yes', [EngineRef(PUBLIC_ENGINE_NAME, 'general')], - ['general'], 'en-US', SAFESEARCH, PAGENO, None, None, + 'en-US', SAFESEARCH, PAGENO, None, None, external_bang="yt") search = searx.search.Search(search_query) results = search.search() @@ -92,7 +92,7 @@ class SearchTestCase(SearxTestCase): search_query = SearchQuery('youtube never gonna give you up', [EngineRef(PUBLIC_ENGINE_NAME, 'general')], - ['general'], 'en-US', SAFESEARCH, PAGENO, None, None) + 'en-US', SAFESEARCH, PAGENO, None, None) search = searx.search.Search(search_query) results = search.search() diff --git a/tests/unit/test_standalone_searx.py b/tests/unit/test_standalone_searx.py index 06d70246a..d16bfe809 100644 --- a/tests/unit/test_standalone_searx.py +++ b/tests/unit/test_standalone_searx.py @@ -102,7 +102,7 @@ class StandaloneSearx(SearxTestCase): search_q = sas.get_search_query(args) self.assertTrue(search_q) self.assertEqual(search_q, SearchQuery('rain', [EngineRef('engine1', 'general', False)], - ['general'], 'all', 0, 1, None, None, None)) + 'all', 0, 1, None, None, None)) def test_no_parsed_url(self): """test no_parsed_url func""" |