diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2026-02-06 14:16:07 +0100 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2026-02-06 14:42:13 +0100 |
| commit | b5bb27f231e5f24b3985cd7cbd3f371486c21a11 (patch) | |
| tree | b09df8696068fe8d3e5e52a3fa2f8ebdf3c90ea9 /tests | |
| parent | 578e59a54e26983099b56d15231164e20e458284 (diff) | |
[fix] test_locale_optimized_territory_1_fr (test_locales.TestLocales)
Unit test fails::
Traceback (most recent call last):
File "/share/searxng/local/py3/lib/python3.10/site-packages/parameterized/parameterized.py", line 620, in standalone_func
return func(*(a + p.args), **p.kwargs, **kw)
File "/share/searxng/tests/unit/test_locales.py", line 121, in test_locale_optimized_territory
self.assertEqual(locales.match_locale(locale, locale_list), expected_locale)
AssertionError: 'fr-CH' != 'fr-BE'
- fr-CH
+ fr-BE
With the `babel` update from 2.17.0 to 2.18.0 the population DB has been
updated (the test was implemented for the old values).
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/test_locales.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/unit/test_locales.py b/tests/unit/test_locales.py index d08f27fdc..6376f3023 100644 --- a/tests/unit/test_locales.py +++ b/tests/unit/test_locales.py @@ -99,11 +99,17 @@ class TestLocales(SearxTestCase): @parameterized.expand( [ - ('fr-BE', ['fr-FR', 'fr-CA', 'nl-BE'], 'nl-BE'), # A user selects region 'fr-BE' which should end in nl-BE - ('fr', ['fr-BE', 'fr-CH'], 'fr-BE'), # A user selects fr with 2 locales, - # the get_engine_locale selects the locale by looking at the "population - # percent" and this percentage has an higher amount in BE (68.%) - # compared to CH (21%) + # approximation rule (*by territory*) -> territory has priority over the lang: + # A user selects region 'fr-BE' which should end in nl-BE + ('fr-BE', ['fr-FR', 'fr-CA', 'nl-BE'], 'nl-BE'), + # approximation rule (*by language*) -> Check in which territories + # the language has an official status and if one of these + # territories is supported: + # A user selects fr with 2 locales where fr is a offical language, + # the get_engine_locale selects the locale by looking at the + # "population percent" and this percentage has a higher amount in + # BE (population 38%) compared to IT (population 20). + ('fr', ['fr-BE', 'fr-IT'], 'fr-BE'), ] ) def test_locale_optimized_territory(self, locale: str, locale_list: list[str], expected_locale: str): |
