]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Fix formatting for "Empty locale identifier" exception added in #1164 (#1184)
authorAarni Koskela <akx@iki.fi>
Mon, 3 Feb 2025 09:06:48 +0000 (11:06 +0200)
committerGitHub <noreply@github.com>
Mon, 3 Feb 2025 09:06:48 +0000 (11:06 +0200)
babel/core.py
tests/test_core.py

index 5762bbe36b41a8a4e481f5814ff191dbfd37e1d0..7386fb37d12f8759c0d10b616b0f8cf32f27eecb 100644 (file)
@@ -343,7 +343,7 @@ class Locale:
                 f"Empty locale identifier value: {identifier!r}\n\n"
                 f"If you didn't explicitly pass an empty value to a Babel function, "
                 f"this could be caused by there being no suitable locale environment "
-                f"variables for the API you tried to use.",
+                f"variables for the API you tried to use."
             )
             if isinstance(identifier, str):
                 raise ValueError(msg)  # `parse_locale` would raise a ValueError, so let's do that here
index aaf95a1c29df0338c552479ba03b2c79f2d0872b..8c215de4a00a23b98eb927c69b741b4ec714044c 100644 (file)
@@ -395,8 +395,9 @@ def test_language_alt_official_not_used():
 
 
 def test_locale_parse_empty():
-    with pytest.raises(ValueError, match="Empty"):
+    with pytest.raises(ValueError, match="Empty") as ei:
         Locale.parse("")
+    assert isinstance(ei.value.args[0], str)
     with pytest.raises(TypeError, match="Empty"):
         Locale.parse(None)
     with pytest.raises(TypeError, match="Empty"):