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
31 lines
829 B
Python
31 lines
829 B
Python
"""@brief Ports the use case needs from the outside world."""
|
|
|
|
from typing import Protocol
|
|
|
|
|
|
class InputClosedError(Exception):
|
|
"""@brief Raised when the user can give no more input (end of input, abort)."""
|
|
|
|
|
|
class WordConsole(Protocol):
|
|
"""@brief Port for the conversation with the user."""
|
|
|
|
def ask_word(self) -> str:
|
|
"""@brief Ask the user for a word.
|
|
|
|
@return The word as typed.
|
|
@throws InputClosedError The user can give no more input.
|
|
"""
|
|
...
|
|
|
|
def show_invalid(self) -> None:
|
|
"""@brief Tell the user that the word was rejected."""
|
|
...
|
|
|
|
def show_code_words(self, code_words: list[str]) -> None:
|
|
"""@brief Show the result to the user.
|
|
|
|
@param code_words The code words to show.
|
|
"""
|
|
...
|