WIP: Overhaul for 4.0.0

This commit is contained in:
kku
2024-12-18 14:16:37 +01:00
parent 5e479ddc79
commit 95d04308bd
32 changed files with 718 additions and 688 deletions

View File

@@ -2,8 +2,7 @@ from pathlib import Path
from typing import Any, List, Union
import pytest
from libbot.i18n import sync
from libbot.i18n import _, in_all_locales, in_every_locale
@pytest.mark.parametrize(
@@ -25,9 +24,9 @@ def test_i18n_get(
location_locale: Path,
):
assert (
sync._(key, *args, locale=locale, locales_root=location_locale)
_(key, *args, locale=locale, locales_root=location_locale)
if locale is not None
else sync._(key, *args, locales_root=location_locale)
else _(key, *args, locales_root=location_locale)
) == expected
@@ -39,10 +38,8 @@ def test_i18n_get(
("nested", ["callbacks", "default"], ["sure", "авжеж"]),
],
)
def test_i18n_in_all_locales(
key: str, args: List[str], expected: Any, location_locale: Path
):
assert (sync.in_all_locales(key, *args, locales_root=location_locale)) == expected
def test_i18n_in_all_locales(key: str, args: List[str], expected: Any, location_locale: Path):
assert (in_all_locales(key, *args, locales_root=location_locale)) == expected
@pytest.mark.parametrize(
@@ -53,7 +50,5 @@ def test_i18n_in_all_locales(
("nested", ["callbacks", "default"], {"en": "sure", "uk": "авжеж"}),
],
)
def test_i18n_in_every_locale(
key: str, args: List[str], expected: Any, location_locale: Path
):
assert (sync.in_every_locale(key, *args, locales_root=location_locale)) == expected
def test_i18n_in_every_locale(key: str, args: List[str], expected: Any, location_locale: Path):
assert (in_every_locale(key, *args, locales_root=location_locale)) == expected