mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Implement models for searx/answerers
sort froms Import List from typing to support Python 3.8 Use SearchQuery model Remove list for List use Dict instead of dict Use RawTextQuery instead of SearchQuery, type a dict, and remove unecessary str() method in webapp improve docstring, remove test code Implement a BaseQuery class and use that, improve answerer tests based on updated types Add back sys fix new linting issues add space Update answerer.py - use dict use future annotations use BaseQuery for RawTextQuery
This commit is contained in:
parent
e2af3e4970
commit
fed105b09e
9 changed files with 95 additions and 32 deletions
|
|
@ -12,5 +12,10 @@ class AnswererTest(SearxTestCase): # pylint: disable=missing-class-docstring
|
|||
query = Mock()
|
||||
unicode_payload = 'árvíztűrő tükörfúrógép'
|
||||
for answerer in answerers:
|
||||
query.query = '{} {}'.format(answerer.keywords[0], unicode_payload)
|
||||
self.assertTrue(isinstance(answerer.answer(query), list))
|
||||
for keyword in answerer.keywords:
|
||||
query.query = '{} {}'.format(keyword, unicode_payload)
|
||||
answer_dicts = answerer.answer(query)
|
||||
self.assertTrue(isinstance(answer_dicts, list))
|
||||
for answer_dict in answer_dicts:
|
||||
self.assertTrue('answer' in answer_dict)
|
||||
self.assertTrue(isinstance(answer_dict['answer'], str))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue