Merge pull request #635 from christianlouis/copilot/remove-translation-content-tests

fix(test): remove tests that assert specific translation content
This commit is contained in:
Christian Krakau-Louis
2026-03-14 09:50:58 +01:00
committed by GitHub
+19 -23
View File
@@ -70,34 +70,28 @@ class TestTranslate:
reload_translations() reload_translations()
@pytest.mark.unit @pytest.mark.unit
def test_translate_english_key(self) -> None: def test_translate_known_key_returns_non_empty_string(self) -> None:
"""English keys should resolve to English text.""" """A valid key should resolve to a non-empty string (not the key itself)."""
result = translate("nav.dashboard", "en") result = translate("nav.dashboard", "en")
assert result == "Dashboard" assert isinstance(result, str)
assert result != ""
assert result != "nav.dashboard"
@pytest.mark.unit @pytest.mark.unit
def test_translate_german_key(self) -> None: def test_translate_non_english_locale_returns_value(self) -> None:
"""German locale should return German text.""" """Non-English locales should return a non-empty translated value."""
result = translate("nav.dashboard", "de") for locale in ("de", "fr", "zh"):
assert result == "Übersicht" result = translate("nav.dashboard", locale)
assert isinstance(result, str)
@pytest.mark.unit assert result != ""
def test_translate_french_key(self) -> None: assert result != "nav.dashboard"
"""French locale should return French text."""
result = translate("nav.dashboard", "fr")
assert result == "Tableau de bord"
@pytest.mark.unit
def test_translate_chinese_key(self) -> None:
"""Chinese locale should return Chinese text."""
result = translate("nav.dashboard", "zh")
assert result == "仪表盘"
@pytest.mark.unit @pytest.mark.unit
def test_translate_fallback_to_english(self) -> None: def test_translate_fallback_to_english(self) -> None:
"""Unknown locale falls back to English.""" """Unknown locale falls back to English translation."""
result = translate("nav.dashboard", "xx") result = translate("nav.dashboard", "xx")
assert result == "Dashboard" english = translate("nav.dashboard", "en")
assert result == english
@pytest.mark.unit @pytest.mark.unit
def test_translate_missing_key_returns_key(self) -> None: def test_translate_missing_key_returns_key(self) -> None:
@@ -109,13 +103,15 @@ class TestTranslate:
def test_translate_none_locale_uses_default(self) -> None: def test_translate_none_locale_uses_default(self) -> None:
"""None locale defaults to English.""" """None locale defaults to English."""
result = translate("nav.dashboard", None) result = translate("nav.dashboard", None)
assert result == "Dashboard" english = translate("nav.dashboard", "en")
assert result == english
@pytest.mark.unit @pytest.mark.unit
def test_translate_with_kwargs(self) -> None: def test_translate_with_kwargs(self) -> None:
"""Placeholders should be interpolated via kwargs.""" """Placeholders should be interpolated via kwargs."""
result = translate("footer.copyright", "en", year="2025") result = translate("footer.copyright", "en", year="2025")
assert result == "DocuElevate 2025" assert "2025" in result
assert result != "footer.copyright"
@pytest.mark.unit @pytest.mark.unit
def test_translate_with_kwargs_german(self) -> None: def test_translate_with_kwargs_german(self) -> None: