Files
030-nato-phonetic-alphabet/tests/adapters/test_csv_alphabet.py
Tirsvad 80ec1bc364 MIL-002 NATO converter: modelling, converter code, tests and Doxygen comments
User story, use case and SSD for "spell a word"; spell_word with
try/except KeyError, generate_phonetic with the retry loop, console and CSV
adapters, 49 pytest tests; MIL-002 and the modelling documents accepted with
review records.

Task: MIL-002#1
Task: MIL-002#2
Task: MIL-002#3
Task: MIL-002#4
Task: MIL-002#5
Task: MIL-002#6
2026-10-14 19:35:08 +08:00

20 lines
587 B
Python

from pathlib import Path
from nato_phonetic_alphabet.adapters.csv_alphabet import load_nato_dict
EXPECTED_ENTRIES = 26
def test_load_nato_dict_reads_temporary_csv(tmp_path: Path) -> None:
data_file = tmp_path / "alphabet.csv"
data_file.write_text("letter,code\na,Alfa\nB,Bravo\n", encoding="utf-8")
assert load_nato_dict(data_file) == {"A": "Alfa", "B": "Bravo"}
def test_load_nato_dict_builds_all_entries_from_packaged_file() -> None:
alphabet = load_nato_dict()
assert len(alphabet) == EXPECTED_ENTRIES
assert alphabet["Z"] == "Zulu"