Files
uconsole_asw_game/tests/test_scenario_texts.py
T
Claude 5456182ee8 Add boat mission 7: convoy attack (1.3.15)
The frigate escorts four merchants; the crewed submarine wins by sinking
two. Only the crewed boat's torpedoes take a merchant, the AI frigate
keeps station ahead of the convoy and prosecutes contacts near it only.
The convoy is remembered in mission_units, so saves stay v23.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019eZphdvoJiBgWqq2zSH4aJ
2026-09-28 10:29:52 +00:00

28 lines
1.1 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"}
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)