File size: 670 Bytes
e6404d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from src.i18n import L10N, t


def test_en_ru_key_parity():
    en = set(L10N["en"].keys())
    ru = set(L10N["ru"].keys())
    assert en == ru, f"Key mismatch ENvsRU: only_en={en - ru}, only_ru={ru - en}"


def test_t_fallback_chain():
    # Known key returns its value.
    assert t("app_title", "en") == "Whyx-PROmpTea"
    # Missing key in RU falls back to EN, then to the raw key.
    assert t("app_title", "ru") == "Whyx-PROmpTea"
    assert t("__not_a_real_key__", "ru") == "__not_a_real_key__"
    assert t("__not_a_real_key__", "en") == "__not_a_real_key__"