Skip to content

Commit 6e4f3ce

Browse files
authored
Test all locales, and skip when file not found
1 parent 863b132 commit 6e4f3ce

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎tests/test_i18n.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,15 @@ def test_none_locale(self) -> None:
336336
assert test_str == humanize.naturaltime(three_seconds)
337337

338338

339-
@pytest.mark.parametrize("locale", ["bn_BD", "ko_KR", "vi_VN"])
339+
@pytest.mark.parametrize(
340+
"locale", sorted(p.name for p in LOCALE_DIR.iterdir() if p.is_dir())
341+
)
340342
def test_intword_unit_has_no_format_placeholder(locale: str) -> None:
341-
"""`intword` interpolates the unit verbatim, so it must carry no placeholder."""
342343
try:
343344
humanize.i18n.activate(locale)
344-
for value in (1_000, 1_000_000, 1_000_000_000, 10**12, 10**15, 10**100):
345+
for value in (1_000, 1_000_000, 1_000_000_000, 10 ** 12, 10 ** 15, 10 ** 100):
345346
assert "%" not in humanize.intword(value)
347+
except FileNotFoundError:
348+
pytest.skip("Generate .mo with scripts/generate-translation-binaries.sh")
346349
finally:
347350
humanize.i18n.deactivate()

0 commit comments

Comments
 (0)