mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Remove RawTextQuery.changeQuery in favor of getNewFullQuery
Also includes the following: - Introduce typing in RawTextQuery - Remove an outdated description based on the change - Refactor setting the autocomplete_location, its more clear to set the variable in the construct instead of within the method - Update unit tests to reflect the new method rephrasing format undo change
This commit is contained in:
parent
f5eb56b63f
commit
81f0cb01e8
4 changed files with 39 additions and 25 deletions
|
|
@ -51,12 +51,19 @@ class TestQuery(SearxTestCase): # pylint:disable=missing-class-docstring
|
|||
r = repr(query)
|
||||
self.assertTrue(r.startswith(f"<RawTextQuery query='{query_text}' "))
|
||||
|
||||
def test_change_query(self):
|
||||
def test_get_new_full_query(self):
|
||||
query_text = '<8 the query'
|
||||
query = RawTextQuery(query_text, [])
|
||||
another_query = query.changeQuery('another text')
|
||||
self.assertEqual(query, another_query)
|
||||
self.assertEqual(query.getFullQuery(), '<8 another text')
|
||||
full_query = query.getFullQuery()
|
||||
new_full_query = query.getNewFullQuery('another text')
|
||||
self.assertNotEqual(full_query, new_full_query)
|
||||
|
||||
def test_get_new_full_query_trim(self):
|
||||
query_text = 'foo bar'
|
||||
query = RawTextQuery(query_text, [])
|
||||
new_query = 'bizz bazz'
|
||||
new_full_query = query.getNewFullQuery(" " + new_query + " ")
|
||||
self.assertEqual(new_query, new_full_query)
|
||||
|
||||
|
||||
class TestLanguageParser(SearxTestCase): # pylint:disable=missing-class-docstring
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue