mirror of
https://github.com/searxng/searxng.git
synced 2024-06-02 13:29:22 +00:00
fed105b09e
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
22 lines
835 B
Python
22 lines
835 B
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# pylint: disable=missing-module-docstring
|
|
|
|
from mock import Mock
|
|
|
|
from searx.answerers import answerers
|
|
from tests import SearxTestCase
|
|
|
|
|
|
class AnswererTest(SearxTestCase): # pylint: disable=missing-class-docstring
|
|
def test_unicode_input(self):
|
|
query = Mock()
|
|
unicode_payload = 'árvíztűrő tükörfúrógép'
|
|
for answerer in answerers:
|
|
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))
|