Skip to content

Commit 27e7303

Browse files
authoredFeb 3, 2025··
Fix formatting for "Empty locale identifier" exception added in #1164 (#1184)
1 parent b50a1d2 commit 27e7303

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
 

‎babel/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def parse(
343343
f"Empty locale identifier value: {identifier!r}\n\n"
344344
f"If you didn't explicitly pass an empty value to a Babel function, "
345345
f"this could be caused by there being no suitable locale environment "
346-
f"variables for the API you tried to use.",
346+
f"variables for the API you tried to use."
347347
)
348348
if isinstance(identifier, str):
349349
raise ValueError(msg) # `parse_locale` would raise a ValueError, so let's do that here

‎tests/test_core.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,9 @@ def test_language_alt_official_not_used():
395395

396396

397397
def test_locale_parse_empty():
398-
with pytest.raises(ValueError, match="Empty"):
398+
with pytest.raises(ValueError, match="Empty") as ei:
399399
Locale.parse("")
400+
assert isinstance(ei.value.args[0], str)
400401
with pytest.raises(TypeError, match="Empty"):
401402
Locale.parse(None)
402403
with pytest.raises(TypeError, match="Empty"):

0 commit comments

Comments
 (0)
Please sign in to comment.