Implement the NATO converter with tests and Doxygen comments

Task: MIL-002#2
Refs #9
Refs #10
Refs #11
Refs #12
Refs #13
This commit is contained in:
2026-10-13 16:39:03 +08:00
parent 1b7da4bcf9
commit e2321a4510
17 changed files with 467 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import subprocess
import sys
from nato_alphabet import constants
def _run_module(stdin_text: str) -> subprocess.CompletedProcess[str]:
return subprocess.run(
[sys.executable, "-m", "nato_alphabet"],
input=stdin_text,
capture_output=True,
text=True,
check=False,
timeout=30,
)
def test_python_dash_m_spells_word_from_piped_input() -> None:
result = _run_module("Hi\n")
assert result.returncode == 0
assert constants.RESULT_TEXT in result.stdout
assert result.stdout.splitlines()[-2:] == ["Hotel", "India"]
def test_python_dash_m_exits_cleanly_on_end_of_input() -> None:
result = _run_module("")
assert result.returncode == 0
assert result.stderr == ""