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
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from nato_phonetic_alphabet import constants
|
||||
|
||||
|
||||
def _run_module(stdin_text: str) -> subprocess.CompletedProcess[str]:
|
||||
return subprocess.run(
|
||||
[sys.executable, "-m", "nato_phonetic_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 == ""
|
||||
Reference in New Issue
Block a user