fixed label under 3d view
This commit is contained in:
@@ -6,6 +6,8 @@ import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
APP_ROOT = Path(__file__).resolve().parents[1]
|
||||
SRC_DIR = APP_ROOT / "src"
|
||||
LOCALES_DIR = APP_ROOT / "config" / "locales"
|
||||
@@ -69,13 +71,6 @@ def test_preference_defaults_match_store_defaults():
|
||||
}
|
||||
|
||||
|
||||
def test_locale_files_are_valid_utf8_json():
|
||||
for name in ("zh_CN", "en_US"):
|
||||
data = _load_locale(name)
|
||||
assert isinstance(data, dict)
|
||||
assert data.get("app", {}).get("title")
|
||||
|
||||
|
||||
#: Sequences that only ever appear when UTF-8 text was decoded as a single-byte
|
||||
#: codepage and then re-encoded. A ``Get-Content -Raw | Set-Content`` round trip
|
||||
#: in Windows PowerShell does exactly that and silently mangles every non-ASCII
|
||||
@@ -92,19 +87,22 @@ _MOJIBAKE = (
|
||||
)
|
||||
|
||||
|
||||
def test_locale_files_are_utf8_without_bom_and_not_mojibake():
|
||||
for name in ("zh_CN", "en_US"):
|
||||
path = LOCALES_DIR / f"{name}.json"
|
||||
raw = path.read_bytes()
|
||||
assert not raw.startswith(b"\xef\xbb\xbf"), f"{name}.json starts with a BOM"
|
||||
text = raw.decode("utf-8") # raises if it is not valid UTF-8
|
||||
@pytest.mark.parametrize("name", ("zh_CN", "en_US"))
|
||||
def test_locale_file_is_valid_utf8_json_without_mojibake(name):
|
||||
path = LOCALES_DIR / f"{name}.json"
|
||||
raw = path.read_bytes()
|
||||
assert not raw.startswith(b"\xef\xbb\xbf"), f"{name}.json starts with a BOM"
|
||||
text = raw.decode("utf-8") # raises if it is not valid UTF-8
|
||||
data = json.loads(text)
|
||||
assert isinstance(data, dict)
|
||||
assert data.get("app", {}).get("title")
|
||||
|
||||
for sequence in _MOJIBAKE:
|
||||
assert sequence not in text, (
|
||||
f"{name}.json contains {sequence!r}: the file was decoded with the "
|
||||
"wrong encoding. Rewrite it with an explicit UTF-8 writer instead "
|
||||
"of a PowerShell Get-Content/Set-Content round trip."
|
||||
)
|
||||
for sequence in _MOJIBAKE:
|
||||
assert sequence not in text, (
|
||||
f"{name}.json contains {sequence!r}: the file was decoded with the "
|
||||
"wrong encoding. Rewrite it with an explicit UTF-8 writer instead "
|
||||
"of a PowerShell Get-Content/Set-Content round trip."
|
||||
)
|
||||
|
||||
|
||||
def test_chinese_locale_actually_contains_chinese():
|
||||
|
||||
Reference in New Issue
Block a user