summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormartin f. krafft <github.com@pobox.madduck.net>2023-01-26 18:46:06 +0100
committerGitHub <noreply@github.com>2023-01-26 19:46:06 +0200
commitd019ed198d90c5dee2b5dd5f39ffa922263f50e4 (patch)
treebb999836bd4e83b263dbbe0f1c3b51abbdc0a109 /tests
parent6bf793ae5b902b3e3f2cb494f2fc230c2641890c (diff)
downloadbabel-d019ed198d90c5dee2b5dd5f39ffa922263f50e4.tar.gz
Keep @modifiers when parsing locales (#947)
Locale modifiers ("@variants") are described in the GNU gettext documentation like this: > The ‘@variant’ can denote any kind of characteristics that is not > already implied by the language ll and the country CC. […] It can also > denote a dialect of the language, … Wherein Babel previously would discard these, this patch stores the modifier information in the `Locale` objects, handling string representation accordingly. Resolves: #946 Signed-off-by: martin f. krafft <madduck@madduck.net> Co-authored-by: Aarni Koskela <akx@iki.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_core.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 2a7e605..0023824 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -283,10 +283,12 @@ def test_parse_locale():
assert (excinfo.value.args[0] ==
"'not_a_LOCALE_String' is not a valid locale identifier")
- assert core.parse_locale('it_IT@euro') == ('it', 'IT', None, None)
+ assert core.parse_locale('it_IT@euro') == ('it', 'IT', None, None, 'euro')
+ assert core.parse_locale('it_IT@something') == ('it', 'IT', None, None, 'something')
+
assert core.parse_locale('en_US.UTF-8') == ('en', 'US', None, None)
assert (core.parse_locale('de_DE.iso885915@euro') ==
- ('de', 'DE', None, None))
+ ('de', 'DE', None, None, 'euro'))
@pytest.mark.parametrize('filename', [