Files
uconsole_asw_game/tests/test_scenario_texts.py
T
Claude f494a04ac2 Merge main (Free patrol 1.3.135, save v46) into the group hunt branch
The free patrol stays last on each side, so the group hunts are scenario 11
and the free patrol 12. This branch's releases move to 1.3.136-1.3.140 and
its consort block to save v47 (step _v46_to_v47, frozen v46 samples).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FVKHiKUKiVW4YEnEF6d99N
2026-10-01 23:46:23 +00:00

36 lines
1.6 KiB
Python

"""Every scenario text the menu shows has a catalog entry in both languages."""
import json
from pathlib import Path
from src.core import config
ROOT = Path(__file__).resolve().parents[1]
KEYS = {"s1_patrouille": "patrol", "s2_doppeljagd": "double",
"s3_abfang": "intercept", "s4_zufall": "random",
"s5_durchbruch": "breakthrough", "s6_aufklaerung": "recon",
"s7_geleitzug": "convoy_attack", "s8_meerenge": "strait",
"s9_kampfschwimmer": "swimmers", "s10_versorger": "escort",
"s11_geleitschutz": "convoy_escort", "s12_datum": "datum",
"s13_fuehlung": "trail", "s14_hafenschutz": "harbour",
"s15_versorgung": "ras", "s16_seenot": "rescue", "s17_duell": "duel",
"s18_heimkehr": "homecoming", "s19_abholung": "pickup",
"s20_lauschposten": "elint", "s21_suchgruppe": "search_group",
"s22_jagdgruppe": "hunter_group",
"frei_fregatte": "free", "frei_uboot": "free_boat"}
def test_menu_goal_and_loss_lines_are_translated():
catalogs = [json.loads((ROOT / f"data/i18n/{lang}.json").read_text(encoding="utf-8"))
for lang in ("en", "de")]
assert set(KEYS) == set(config.SCENARIOS) == set(config.SCENARIO_ORDER)
assert config.SCENARIO_NAMES == KEYS
for scenario, name in KEYS.items():
spec = config.SCENARIOS[scenario]
wanted = ["title", "brief"]
wanted += ["win"] if spec["win_text"] else []
wanted += ["lose"] if spec["lose_text"] else []
for field in wanted:
for catalog in catalogs:
assert f"scenario.{name}.{field}" in catalog, (scenario, field)