summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_utils.py8
-rw-r--r--tests/unit/test_webapp.py4
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py
index e9c247382..bea28c0cc 100644
--- a/tests/unit/test_utils.py
+++ b/tests/unit/test_utils.py
@@ -92,6 +92,14 @@ class TestUtils(SearxTestCase):
self.assertEqual(utils.match_language('es', [], fallback='fallback'), 'fallback')
self.assertEqual(utils.match_language('ja', ['jp'], {'ja': 'jp'}), 'jp')
+ # handle script tags
+ self.assertEqual(utils.match_language('zh-CN', ['zh-Hans-CN', 'zh-Hant-TW']), 'zh-Hans-CN')
+ self.assertEqual(utils.match_language('zh-TW', ['zh-Hans-CN', 'zh-Hant-TW']), 'zh-Hant-TW')
+ self.assertEqual(utils.match_language('zh-Hans-CN', ['zh-CN', 'zh-TW']), 'zh-CN')
+ self.assertEqual(utils.match_language('zh-Hant-TW', ['zh-CN', 'zh-TW']), 'zh-TW')
+ self.assertEqual(utils.match_language('zh-Hans', ['zh-CN', 'zh-TW', 'zh-HK']), 'zh-CN')
+ self.assertEqual(utils.match_language('zh-Hant', ['zh-CN', 'zh-TW', 'zh-HK']), 'zh-TW')
+
aliases = {'en-GB': 'en-UK', 'he': 'iw'}
# guess country
diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py
index c2d57f80c..30b2839a8 100644
--- a/tests/unit/test_webapp.py
+++ b/tests/unit/test_webapp.py
@@ -211,12 +211,12 @@ class ViewsTestCase(SearxTestCase):
result = self.app.get('/preferences', headers={'Accept-Language': 'zh-tw;q=0.8'})
self.assertEqual(result.status_code, 200)
self.assertIn(
- b'<option value="zh_TW" selected="selected">',
+ b'<option value="zh_Hant_TW" selected="selected">',
result.data,
'Interface locale ignored browser preference.'
)
self.assertIn(
- b'<option value="zh-TW" selected="selected">',
+ b'<option value="zh_Hant_TW" selected="selected">',
result.data,
'Search language ignored browser preference.'
)