From 14d625b5c8a69d8bc6e14f240c4fabe471fc20dc Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 3 Feb 2025 10:59:31 +0200 Subject: [PATCH] Fix formatting for "Empty locale identifier" exception added in #1164 --- babel/core.py | 2 +- tests/test_core.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/babel/core.py b/babel/core.py index 5762bbe3..7386fb37 100644 --- a/babel/core.py +++ b/babel/core.py @@ -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 diff --git a/tests/test_core.py b/tests/test_core.py index aaf95a1c..8c215de4 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -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"): -- 2.47.2