From 6748e8e2d5eff3c2202b2a714afb5534b1573101 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Fri, 16 Dec 2022 20:28:57 +0000 Subject: Add "Auto-detected" as a language. When the user choose "Auto-detected", the choice remains on the following queries. The detected language is displayed. For example "Auto-detected (en)": * the next query language is going to be auto detected * for the current query, the detected language is English. This replace the autodetect_search_language plugin. --- tests/unit/test_query.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/unit/test_query.py') diff --git a/tests/unit/test_query.py b/tests/unit/test_query.py index db25da8f3..7274a8da5 100644 --- a/tests/unit/test_query.py +++ b/tests/unit/test_query.py @@ -91,6 +91,17 @@ class TestLanguageParser(SearxTestCase): self.assertIn('all', query.languages) self.assertFalse(query.specific) + def test_auto_language_code(self): + language = 'auto' + query_text = 'una consulta' + full_query = ':' + language + ' ' + query_text + query = RawTextQuery(full_query, []) + + self.assertEqual(query.getFullQuery(), full_query) + self.assertEqual(len(query.query_parts), 1) + self.assertIn('auto', query.languages) + self.assertFalse(query.specific) + def test_invalid_language_code(self): language = 'not_a_language' query_text = 'the query' -- cgit v1.2.3