Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/humanize/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def activate(
dict: Translations.

Raises:
Exception: If humanize cannot find the locale folder.
FileNotFoundError: If humanize cannot find the locale folder.
"""
if locale is None or locale.startswith("en"):
_CURRENT.locale = None
Expand All @@ -85,7 +85,7 @@ def activate(
"Humanize cannot determinate the default location of the 'locale' folder. "
"You need to pass the path explicitly."
)
raise Exception(msg)
raise FileNotFoundError(msg)
if locale not in _TRANSLATIONS:
translation = gettext_module.translation("humanize", path, [locale])
_TRANSLATIONS[locale] = translation
Expand Down
4 changes: 2 additions & 2 deletions tests/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def test_default_locale_path_null__spec__(
i18n = importlib.import_module("humanize.i18n")
monkeypatch.setattr(i18n, "__spec__", None)

with pytest.raises(Exception, match=self.expected_msg):
with pytest.raises(FileNotFoundError, match=self.expected_msg):
i18n.activate("ru_RU")

def test_default_locale_path_undefined__spec__(
Expand All @@ -237,7 +237,7 @@ def test_default_locale_path_undefined__spec__(
i18n = importlib.import_module("humanize.i18n")
monkeypatch.delattr(i18n, "__spec__")

with pytest.raises(Exception, match=self.expected_msg):
with pytest.raises(FileNotFoundError, match=self.expected_msg):
i18n.activate("ru_RU")

@freeze_time("2020-02-02")
Expand Down
Loading