Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3150fc4755 | ||
|
|
c53cb3fb4a | ||
|
|
d367c2f881 | ||
|
|
b69a604341 | ||
|
|
44c1e69fb3 | ||
|
|
e7f2473d99 | ||
|
|
80ec1bc364 | ||
|
|
12a5cb5562 |
@@ -1,2 +1,207 @@
|
|||||||
# 030-nato-phonetic-alphabet
|
# 🚀 NATO phonetic alphabet
|
||||||
|
|
||||||
|
A console tool that spells a word with the NATO phonetic alphabet and handles invalid input with exception handling, the Day 30 assignment of Udemy's "100 Days of Code: The Complete Python Pro Bootcamp". It is written for fellow course participants and GitHub visitors who want a readable, tested, runnable solution that has no runtime dependencies.
|
||||||
|
|
||||||
|
![The tool spelling the word Hello][screenshot-spell]
|
||||||
|
|
||||||
|
## 📚 Table of Contents
|
||||||
|
|
||||||
|
- [Overview](#-overview)
|
||||||
|
- [Requirements](#-requirements)
|
||||||
|
- [Setup](#-setup)
|
||||||
|
- [Run](#-run)
|
||||||
|
- [Tests](#-tests)
|
||||||
|
- [Continuous integration](#-continuous-integration)
|
||||||
|
- [Build the source documentation](#-build-the-source-documentation)
|
||||||
|
- [Project layout](#-project-layout)
|
||||||
|
- [License](#-license)
|
||||||
|
- [Links](#-links)
|
||||||
|
- [Appendix: Project documents](#-appendix-project-documents)
|
||||||
|
|
||||||
|
## 🧭 Overview
|
||||||
|
|
||||||
|
You type a word, the program prints the NATO code word of each letter. A character that is not a letter does not crash the program: the error is caught, you are told to enter letters only, and the program asks again.
|
||||||
|
|
||||||
|
```text
|
||||||
|
Enter a word: Hello
|
||||||
|
Phonetic code words:
|
||||||
|
Hotel
|
||||||
|
Echo
|
||||||
|
Lima
|
||||||
|
Lima
|
||||||
|
Oscar
|
||||||
|
```
|
||||||
|
|
||||||
|
How it works, in the course's terms:
|
||||||
|
|
||||||
|
- `load_nato_dict` reads the supplied CSV file and builds the letter-to-code-word dictionary with a **dictionary comprehension**.
|
||||||
|
- `spell_word` turns a word into its code words with a **list comprehension** inside a `try` block; a character that is not in the alphabet raises a `KeyError`, which the `except` block turns into an `InvalidWordError`.
|
||||||
|
- `generate_phonetic` wraps the input and the error handling: it asks for a word, reports an invalid one and asks again until the word is valid.
|
||||||
|
- The standard library `csv` module replaces Pandas, so the project has no runtime dependencies (see the architecture decision record [ADR-0001][ADR-0001]).
|
||||||
|
|
||||||
|
The wiki explains installation, usage and development in English, Danish and Bahasa Malaysia: [wiki][wiki].
|
||||||
|
|
||||||
|
## 📋 Requirements
|
||||||
|
|
||||||
|
- Python 3.13 or newer, with the `venv` module.
|
||||||
|
- Git, to clone the repository.
|
||||||
|
- Optional: [Doxygen](https://www.doxygen.nl/) to build the source documentation.
|
||||||
|
|
||||||
|
The program itself needs no packages. The development tools (pytest, ruff, mypy, import-linter) are installed by the `dev` extra.
|
||||||
|
|
||||||
|
## 🛠️ Setup
|
||||||
|
|
||||||
|
Clone the repository, then create a local virtual environment named `.venv` in its root, upgrade pip and install the project in editable mode with its development tools.
|
||||||
|
|
||||||
|
### Windows PowerShell
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
py -3.13 -m venv .venv
|
||||||
|
.\.venv\Scripts\Activate.ps1
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
If PowerShell refuses to run the activation script, allow it for this window only with `Set-ExecutionPolicy -Scope Process RemoteSigned`.
|
||||||
|
|
||||||
|
### Linux Debian
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install git python3 python3-venv
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
Debian 13 (trixie) ships Python 3.13. On an older release install Python 3.13 first (for example with `pyenv`).
|
||||||
|
|
||||||
|
### MacOS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install python@3.13 git
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
python3.13 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
## ▶️ Run
|
||||||
|
|
||||||
|
With the virtual environment active:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m nato_phonetic_alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
or, as the installed command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nato-phonetic-alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
An invalid character asks for the word again:
|
||||||
|
|
||||||
|
![A word with a digit is rejected, then a valid word is spelled][screenshot-retry]
|
||||||
|
|
||||||
|
## 🧪 Tests
|
||||||
|
|
||||||
|
Run the tests with the virtual environment active:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pytest
|
||||||
|
```
|
||||||
|
|
||||||
|
The same checks that CI runs:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m ruff check .
|
||||||
|
python -m mypy
|
||||||
|
lint-imports
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔄 Continuous integration
|
||||||
|
|
||||||
|
The workflow [`.gitea/workflows/ci.yml`](.gitea/workflows/ci.yml) runs on every push to `main` or a `mil-*` branch and on every pull request that touches source, tests or configuration. It sets up Python 3.13, creates a virtual environment, installs the project with the `dev` extra, and runs ruff, mypy and pytest.
|
||||||
|
|
||||||
|
## 📖 Build the source documentation
|
||||||
|
|
||||||
|
The source is documented with Doxygen comments. From the repository root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
doxygen Doxyfile
|
||||||
|
```
|
||||||
|
|
||||||
|
Open `build/html/index.html` in a browser. The `build/` folder is ignored by git.
|
||||||
|
|
||||||
|
## 🗂️ Project layout
|
||||||
|
|
||||||
|
```text
|
||||||
|
src/nato_phonetic_alphabet/
|
||||||
|
constants.py every literal of the program
|
||||||
|
main.py composition root and entry point
|
||||||
|
__main__.py python -m nato_phonetic_alphabet
|
||||||
|
domain/ spell_word, the spelling rule with try/except (no input or output)
|
||||||
|
application/ generate_phonetic (input and retry loop) and its port
|
||||||
|
adapters/ CSV reader and console
|
||||||
|
data/ nato_phonetic_alphabet.csv
|
||||||
|
tests/ pytest tests, mirroring src/
|
||||||
|
docs/ project documents (see the appendix)
|
||||||
|
docs/wiki/ wiki pages in en, da and ms
|
||||||
|
.gitea/workflows/ CI workflow
|
||||||
|
pyproject.toml project configuration
|
||||||
|
Doxyfile Doxygen configuration
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📄 License
|
||||||
|
|
||||||
|
GNU Affero General Public License v3.0 or later. See [LICENSE](LICENSE).
|
||||||
|
|
||||||
|
## 🔗 Links
|
||||||
|
|
||||||
|
- [Repository][repository]
|
||||||
|
- [Documentation][documentation]
|
||||||
|
- [Issue tracker][issues]
|
||||||
|
|
||||||
|
## 📎 Appendix: Project documents
|
||||||
|
|
||||||
|
The documents a newcomer needs, in reading order.
|
||||||
|
|
||||||
|
| Document | What it tells you |
|
||||||
|
| --- | --- |
|
||||||
|
| [AGENTS.md][agents] | The rules AI agents follow in this repository |
|
||||||
|
| [Business Case][BC-001] | Why the project exists, its scope and success criteria |
|
||||||
|
| [Stakeholder Analysis][SA-001] | Who is involved; the stakeholder IDs used for owners and reviewers |
|
||||||
|
| [Project Plan][PP-001] | The gateways and their schedule |
|
||||||
|
| [Milestones][milestones] | One document per gateway: Go/No-Go criteria and tasks |
|
||||||
|
| [Architecture decisions][adr] | Why the data is read with the standard library and which analysis documents were skipped |
|
||||||
|
| [Artifact registry][registry] | Where each artifact type lives, the next version, the PO language and domain |
|
||||||
|
| [Traceability matrix][TM-001] | How the artifacts link and when each was last reviewed |
|
||||||
|
| [Framework README][framework-readme] | The framework this project uses |
|
||||||
|
| [Framework changelog][framework-changelog] | What changed in each framework release |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[repository]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet
|
||||||
|
[documentation]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/wiki
|
||||||
|
[wiki]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/wiki
|
||||||
|
[issues]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/issues
|
||||||
|
[screenshot-spell]: ./docs/images/spell-word.png
|
||||||
|
[screenshot-retry]: ./docs/images/retry-invalid.png
|
||||||
|
[agents]: ./AGENTS.md
|
||||||
|
[BC-001]: ./docs/business-case.md
|
||||||
|
[SA-001]: ./docs/stakeholder-analysis.md
|
||||||
|
[PP-001]: ./docs/project-plan.md
|
||||||
|
[milestones]: ./docs/milestones/
|
||||||
|
[adr]: ./docs/adr/
|
||||||
|
[ADR-0001]: ./docs/adr/adr-0001-read-nato-data-with-csv-module.md
|
||||||
|
[registry]: ./docs/artifact-registry.md
|
||||||
|
[TM-001]: ./docs/sqa/traceability-matrix.md
|
||||||
|
[framework-readme]: ./framework/README.md
|
||||||
|
[framework-changelog]: ./framework/CHANGELOG.md
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ document of a type. `Primary File` may contain a glob (e.g.
|
|||||||
| SA | Stakeholder Analysis | docs/stakeholder-analysis.md | 002 |
|
| SA | Stakeholder Analysis | docs/stakeholder-analysis.md | 002 |
|
||||||
| PP | Project Plan | docs/project-plan.md | 002 |
|
| PP | Project Plan | docs/project-plan.md | 002 |
|
||||||
| MIL | Milestone / Gateway | docs/milestones/*.md | 004 |
|
| MIL | Milestone / Gateway | docs/milestones/*.md | 004 |
|
||||||
| RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 001 |
|
| RC | SQA Review Record | docs/sqa/reviews/rc-*.md | 015 |
|
||||||
|
| TM | Traceability Matrix | docs/sqa/traceability-matrix.md | 002 |
|
||||||
| ADR | Architecture Decision Record | docs/adr/adr-NNNN-*.md | 0003 |
|
| ADR | Architecture Decision Record | docs/adr/adr-NNNN-*.md | 0003 |
|
||||||
| UCD | Use Case Diagram | docs/use-case-diagram.md | 002 |
|
| UCD | Use Case Diagram | docs/use-case-diagram.md | 002 |
|
||||||
| US | User Story | docs/user-stories.md | 002 |
|
| US | User Story | docs/user-stories.md | 002 |
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,77 @@
|
|||||||
|
# MIL-002 NATO converter
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | MIL-002 |
|
||||||
|
| CrossReference | [BC-001] |
|
||||||
|
| Language | en |
|
||||||
|
| Domain | it |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version, reviewed in RC-004 | [80ec1bc] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
Decide whether the console program does what the Day 30 assignment asks: read a word, print the NATO code word of each letter, and handle invalid input with exception handling (a `try`/`except` on the failed dictionary lookup) inside `generate_phonetic`, which keeps asking until the input is valid. Tested with pytest.
|
||||||
|
|
||||||
|
## Deliverable
|
||||||
|
|
||||||
|
The `nato_phonetic_alphabet` package with a runnable entry point, a test suite that passes, and Doxygen comments on every public item; plus the user story, use case and system sequence diagram of "spell a word".
|
||||||
|
|
||||||
|
## Go / No-Go Criteria
|
||||||
|
|
||||||
|
| # | Criterion (objectively checkable) | Go | No-Go |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | All 26 letters map to their code word and input is case-insensitive | pytest passes | Any test fails |
|
||||||
|
| 2 | A character that is not a letter raises a caught `KeyError`; the program tells the user to enter letters of the alphabet only and asks again instead of crashing | pytest covers it and passes | Missing or failing |
|
||||||
|
| 3 | The loader uses a dictionary comprehension, the converter a list comprehension, and the invalid input is handled with `try`/`except`, not with a pre-check | Code review confirms | Loops or pre-checks used instead |
|
||||||
|
| 4 | The assignment's function names are kept in the public API | Names present in the module | Names missing |
|
||||||
|
| 5 | The code review against `qc-programming-python.md` is a `Go` | `RC-*` verdict `Go` | `No-Go` |
|
||||||
|
| 6 | `doxygen Doxyfile` reports no warnings | 0 warnings | Any warning |
|
||||||
|
| 7 | Constants live in `constants.py`; `.env` is not imported by `src/` or `tests/` | Search confirms | Any hit |
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
| Depends on | Reason |
|
||||||
|
| --- | --- |
|
||||||
|
| [MIL-001] | Project configuration, skeleton, CI and Doxyfile |
|
||||||
|
|
||||||
|
## Traceability
|
||||||
|
|
||||||
|
| Business Case objective / KPI / user story | Reference |
|
||||||
|
| --- | --- |
|
||||||
|
| O1, O3, O4 | [BC-001] |
|
||||||
|
| Spell a word | US-001, UC-001 |
|
||||||
|
|
||||||
|
## Ownership
|
||||||
|
|
||||||
|
| Role | Stakeholder ID (SA) |
|
||||||
|
| --- | --- |
|
||||||
|
| Owner | S01 |
|
||||||
|
| Approving reviewer | S01 |
|
||||||
|
|
||||||
|
## Target Date
|
||||||
|
|
||||||
|
2026-10-15 — inside the plan's window (2026-10-14 to 2026-10-16).
|
||||||
|
|
||||||
|
## Tasks
|
||||||
|
|
||||||
|
| # | Task | Summary | Needs its own Use Case/User Story? | Reference |
|
||||||
|
| --- | --- | --- | --- | --- |
|
||||||
|
| 1 | Model "spell a word" | Write US-001, UC-001 (brief) and the system sequence diagram for the user who types a word and receives its NATO code words, including the retry on invalid input. Domain concepts are only letter and code word, so no domain model is added. | Yes | US-001, UC-001 |
|
||||||
|
| 2 | Load the NATO alphabet | Read the CSV with the standard library and build the letter-to-code-word dictionary with a dictionary comprehension (`load_nato_dict`), taking the file name from `constants.py`. | No | |
|
||||||
|
| 3 | Convert a word to code words | Implement the assignment's `generate_phonetic`: it prompts for a word, builds the code words with a list comprehension inside a `try` block, catches the `KeyError` of a character that is not a letter, tells the user to enter letters of the alphabet only, and loops until the input is valid. The lookup and the prompt sit behind ports so the layers stay separate. | Yes | UC-001 |
|
||||||
|
| 4 | Implement the console entry point | Prompt for a word, print the code words, ask again on invalid input; runnable as `python -m nato_phonetic_alphabet` and as the `nato-phonetic-alphabet` command. | Yes | UC-001 |
|
||||||
|
| 5 | Write the pytest suite | Test all letters, mixed case, unknown characters, the loader (with a temporary CSV) and the entry point (with patched input and captured output). | No | |
|
||||||
|
| 6 | Add Doxygen comments | Document every module, function and constant with Doxygen comments and confirm the build has no warnings. | No | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[BC-001]: ../business-case.md
|
||||||
|
[MIL-001]: ./mil-001-repository-foundation.md
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
# MIL-003 Documentation and publication
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | MIL-003 |
|
||||||
|
| CrossReference | [BC-001] |
|
||||||
|
| Language | en |
|
||||||
|
| Domain | it |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version, adapted from the 026 NATO alphabet project | [80ec1bc] |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Reviewed in RC-005 | [b69a604] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
Decide whether S02 and S03 can understand, set up and run the project from its README and wiki without help, in English, Danish and Bahasa Malaysia.
|
||||||
|
|
||||||
|
## Deliverable
|
||||||
|
|
||||||
|
The `README.md` built from the framework template with screenshots, and a wiki in English, Danish and Bahasa Malaysia with the same pages and screenshots, published on the git host.
|
||||||
|
|
||||||
|
## Go / No-Go Criteria
|
||||||
|
|
||||||
|
| # | Criterion (objectively checkable) | Go | No-Go |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | `check-readme.sh` reports no finding for the README | Exit code 0 | Any finding |
|
||||||
|
| 2 | The README steps (create `.venv`, upgrade pip, install, run, test) work on a fresh clone on Windows PowerShell | The run produces the expected output | A step fails |
|
||||||
|
| 3 | Every wiki page exists in en, da and ms | `check-languages.sh` and a file listing agree | A page is missing |
|
||||||
|
| 4 | The README and each wiki language show a screenshot | Image files exist and are linked | Missing |
|
||||||
|
| 5 | The wiki is published and readable on the host | Page requests return success | Any page not found |
|
||||||
|
| 6 | `doxygen Doxyfile` builds and the README says how | Exit code 0 and the section exists | Missing |
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
| Depends on | Reason |
|
||||||
|
| --- | --- |
|
||||||
|
| [MIL-002] | The documentation describes the finished program |
|
||||||
|
|
||||||
|
## Traceability
|
||||||
|
|
||||||
|
| Business Case objective / KPI / user story | Reference |
|
||||||
|
| --- | --- |
|
||||||
|
| O2, O4, O5 | [BC-001] |
|
||||||
|
|
||||||
|
## Ownership
|
||||||
|
|
||||||
|
| Role | Stakeholder ID (SA) |
|
||||||
|
| --- | --- |
|
||||||
|
| Owner | S01 |
|
||||||
|
| Approving reviewer | S01 |
|
||||||
|
|
||||||
|
## Target Date
|
||||||
|
|
||||||
|
2026-10-16 — the end of the plan's window.
|
||||||
|
|
||||||
|
## Tasks
|
||||||
|
|
||||||
|
| # | Task | Summary | Needs its own Use Case/User Story? | Reference |
|
||||||
|
| --- | --- | --- | --- | --- |
|
||||||
|
| 1 | Capture screenshots | Run the program and render its real output as PNG images (a word spelled, an invalid input retried) stored under `docs/images/` for the README and the wiki. | No | |
|
||||||
|
| 2 | Write the README | Fill the framework README template: set-up on Windows PowerShell, Linux Debian and macOS with a local `.venv` and `python -m pip install --upgrade pip`, run, tests, continuous integration, Doxygen build, layout and licence. | No | |
|
||||||
|
| 3 | Write the English wiki | Pages Home, Install, Usage and Development in English with screenshots, in the layout of the framework wiki. | No | |
|
||||||
|
| 4 | Write the Danish wiki | The same pages in Danish with the `-da` suffix. | No | |
|
||||||
|
| 5 | Write the Bahasa Malaysia wiki | The same pages in Bahasa Malaysia with the `-ms` suffix. | No | |
|
||||||
|
| 6 | Publish the wiki | Push the pages to the repository's wiki on the git host and check that each page is readable. | No | |
|
||||||
|
| 7 | Verify the set-up instructions | Follow the README from a fresh clone in a new `.venv`, run the program and the tests, and record the result in the review. | No | |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[BC-001]: ../business-case.md
|
||||||
|
[MIL-002]: ./mil-002-nato-converter.md
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
|
[b69a604]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/b69a604341251be410672cee93910e528eecaef8
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
# SQA Review Record RC-004: MIL-002
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | RC-004 |
|
||||||
|
| CrossReference | [MIL-002], [QC-MIL-001], [QC-LANG-001] |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Review of MIL-002 | [80ec1bc] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Artifact Under Review
|
||||||
|
|
||||||
|
- Instance reviewed: [MIL-002]
|
||||||
|
- Checklist used: [QC-MIL-001] and [QC-LANG-001]
|
||||||
|
- Scope: full review
|
||||||
|
- Language and domain: en / it
|
||||||
|
- Language reviewer: none (the reviewer reads the language and knows the domain)
|
||||||
|
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`)
|
||||||
|
|
||||||
|
## Checklist Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | A concrete deliverable is defined for every gate | Pass | Deliverable section names concrete output: working console program, tests, Doxygen comments, user story and use case. |
|
||||||
|
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | Go / No-Go table has objectively checkable rows (commands and counts). |
|
||||||
|
| 3 | Dependencies on other milestones are explicitly mapped | Pass | Dependencies table is filled. |
|
||||||
|
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | Traceability cites [BC-001] objectives. |
|
||||||
|
| 5 | Milestone owner and approving reviewer are identified | Pass | Owner and approving reviewer are S01. |
|
||||||
|
| 6 | Milestone has a defined target date consistent with project constraints | Pass | Target date lies inside the Project Plan window; the Business Case sets no calendar constraint. |
|
||||||
|
|
||||||
|
## Language and Domain Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | The Metadata table has a `Language` row and a `Domain` row, and neither is a placeholder | Pass | `Language | en` and `Domain | it` are in the Metadata table. |
|
||||||
|
| 2 | `Language` is a BCP 47 code and `Domain` is a value from the registry's domain list | Pass | `en` is a BCP 47 code; `it` is in the registry's domain list. |
|
||||||
|
| 3 | The content (prose and table cells) is written in the stated language | Pass | All prose and table cells are English; the course title is quoted source text. Checked by the stand-in reviewer, who reads English. |
|
||||||
|
| 4 | The register matches the one the registry gives for the artifact type | Pass | The registry gives IT Executive English for this type; the text matches it. |
|
||||||
|
| 5 | Domain terms are the PO terms of the domain's dictionary, with no synonyms | Pass | No dictionary (`DICT`) exists yet; the terms letter, code word and NATO alphabet are used consistently with no synonyms. Checked by the stand-in; open to challenge. |
|
||||||
|
| 6 | Metadata keys, section headings, IDs and statuses are in English | Pass | Metadata keys, headings, IDs and statuses are English. |
|
||||||
|
| 7 | No translated twin (`<name>.<language>.md`) exists beside the document | Pass | No translated twin of the file exists. |
|
||||||
|
| 8 | A change of language or domain since the previous accepted version has a Version History row and was reviewed again | Pass | First version; no change of language or domain. |
|
||||||
|
| 9 | A reviewer competent in the domain, and in the language, has confirmed that the domain terms are used correctly | Pass | The domain is software and IT and the language English; the reviewer stood in for (S01) reads both. A person may challenge this in the run summary. |
|
||||||
|
| 10 | Abbreviations are spelled out on first use, in the stated language | Pass | Abbreviations are spelled out on first use or are identifiers (IDs, tool names). |
|
||||||
|
|
||||||
|
## Overall Verdict
|
||||||
|
|
||||||
|
Go — every Mandatory criterion of QC-MIL-001 and of QC-LANG-001 passes. The review is a stand-in review by the author's AI and is not independent; it is open to challenge in the run summary.
|
||||||
|
|
||||||
|
## Action Items
|
||||||
|
|
||||||
|
| Action | Owner | Due |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| None | S01 | n/a |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[MIL-002]: ../../milestones/mil-002-nato-converter.md
|
||||||
|
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
|
||||||
|
[QC-LANG-001]: ../../../framework/qc/artifacts/qc-language-domain.md
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
# SQA Review Record RC-005: MIL-003
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | RC-005 |
|
||||||
|
| CrossReference | [MIL-003], [QC-MIL-001], [QC-LANG-001] |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Review of MIL-003 | [d367c2f] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Artifact Under Review
|
||||||
|
|
||||||
|
- Instance reviewed: [MIL-003]
|
||||||
|
- Checklist used: [QC-MIL-001] and [QC-LANG-001]
|
||||||
|
- Scope: full review
|
||||||
|
- Language and domain: en / it
|
||||||
|
- Language reviewer: none (the reviewer reads the language and knows the domain)
|
||||||
|
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`)
|
||||||
|
|
||||||
|
## Checklist Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | A concrete deliverable is defined for every gate | Pass | Deliverable section names concrete output: README, screenshots and wiki in three languages. |
|
||||||
|
| 2 | Explicit Go/No-Go criteria are stated for each gate | Pass | Go / No-Go table has objectively checkable rows (commands and counts). |
|
||||||
|
| 3 | Dependencies on other milestones are explicitly mapped | Pass | Dependencies table is filled. |
|
||||||
|
| 4 | Each milestone is traceable to a Business Case objective or KPI | Pass | Traceability cites [BC-001] objectives. |
|
||||||
|
| 5 | Milestone owner and approving reviewer are identified | Pass | Owner and approving reviewer are S01. |
|
||||||
|
| 6 | Milestone has a defined target date consistent with project constraints | Pass | Target date lies inside the Project Plan window; the Business Case sets no calendar constraint. |
|
||||||
|
|
||||||
|
## Language and Domain Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | The Metadata table has a `Language` row and a `Domain` row, and neither is a placeholder | Pass | `Language | en` and `Domain | it` are in the Metadata table. |
|
||||||
|
| 2 | `Language` is a BCP 47 code and `Domain` is a value from the registry's domain list | Pass | `en` is a BCP 47 code; `it` is in the registry's domain list. |
|
||||||
|
| 3 | The content (prose and table cells) is written in the stated language | Pass | All prose and table cells are English; the course title is quoted source text. Checked by the stand-in reviewer, who reads English. |
|
||||||
|
| 4 | The register matches the one the registry gives for the artifact type | Pass | The registry gives IT Executive English for this type; the text matches it. |
|
||||||
|
| 5 | Domain terms are the PO terms of the domain's dictionary, with no synonyms | Pass | No dictionary (`DICT`) exists yet; the terms letter, code word and NATO alphabet are used consistently with no synonyms. Checked by the stand-in; open to challenge. |
|
||||||
|
| 6 | Metadata keys, section headings, IDs and statuses are in English | Pass | Metadata keys, headings, IDs and statuses are English. |
|
||||||
|
| 7 | No translated twin (`<name>.<language>.md`) exists beside the document | Pass | No translated twin of the file exists. |
|
||||||
|
| 8 | A change of language or domain since the previous accepted version has a Version History row and was reviewed again | Pass | First version; no change of language or domain. |
|
||||||
|
| 9 | A reviewer competent in the domain, and in the language, has confirmed that the domain terms are used correctly | Pass | The domain is software and IT and the language English; the reviewer stood in for (S01) reads both. A person may challenge this in the run summary. |
|
||||||
|
| 10 | Abbreviations are spelled out on first use, in the stated language | Pass | Abbreviations are spelled out on first use or are identifiers (IDs, tool names). |
|
||||||
|
|
||||||
|
## Overall Verdict
|
||||||
|
|
||||||
|
Go — every Mandatory criterion of QC-MIL-001 and of QC-LANG-001 passes. Delivery evidence for the Go/No-Go criteria: `check-readme.sh` exits 0; the wiki pages Home, Install, Usage and Development exist in en, da and ms and answer HTTP 200 on the host, as does the screenshot; a fresh clone with a new `.venv` follows the README (`python -m pip install --upgrade pip`, `python -m pip install -e ".[dev]"`, `python -m pytest` 49 passed, the program run, `doxygen Doxyfile` with 0 warnings). The review is a stand-in review by the author's AI and is not independent; it is open to challenge in the run summary.
|
||||||
|
|
||||||
|
## Action Items
|
||||||
|
|
||||||
|
| Action | Owner | Due |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| None | S01 | n/a |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[MIL-003]: ../../milestones/mil-003-documentation-and-publication.md
|
||||||
|
[QC-MIL-001]: ../../../framework/qc/artifacts/qc-milestones-gateways.md
|
||||||
|
[QC-LANG-001]: ../../../framework/qc/artifacts/qc-language-domain.md
|
||||||
|
[d367c2f]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/d367c2f8814623a0ad2c7b5c4646c155a086c82d
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
# SQA Review Record RC-010: UCD-001
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | RC-010 |
|
||||||
|
| CrossReference | [UCD-001], [QC-UCD-001] |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Review of UCD-001 | [80ec1bc] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Artifact Under Review
|
||||||
|
|
||||||
|
- Instance reviewed: [UCD-001]
|
||||||
|
- Checklist used: [QC-UCD-001]
|
||||||
|
- Scope: full review
|
||||||
|
- Language and domain: en / it
|
||||||
|
- Language reviewer: none
|
||||||
|
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`)
|
||||||
|
|
||||||
|
## Checklist Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | Actors are defined with correct UML stereotypes (e.g. `<<System>>`, `<<Actor>>`) | Pass | Actor `<<Actor>>` and system `<<System>>` in the diagram and actor table. |
|
||||||
|
| 2 | System boundary is clearly drawn and labeled | Pass | The rectangle is labelled "NATO alphabet tool". |
|
||||||
|
| 3 | Include/extend relationships are used correctly per UML 2.5.1, not as generic "uses" arrows | Pass | No include or extend is used; the Relationships table says so. |
|
||||||
|
| 4 | Every actor participates in at least one use case (no orphan actors) | Pass | The User takes part in Spell a Word. |
|
||||||
|
| 5 | Diagram is traceable to a documented stakeholder need | Pass | The actor table cites S01 and S02 from [SA-001]. |
|
||||||
|
| 6 | Use case names are verb phrases describing actor goals, not internal system operations | Pass | "Spell a Word" is a verb phrase describing the actor's goal. |
|
||||||
|
| 7 | Diagram is free of implementation detail (e.g. UI widgets, database tables) | Pass | No interface or storage detail. |
|
||||||
|
| 8 | Actor and use case naming is consistent with corresponding Use Case and User Story documents | Pass | Actor `User` and use case `Spell a Word` are named alike in US-001 and UC-001. |
|
||||||
|
|
||||||
|
## Language and Domain Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | The Metadata table has a `Language` row and a `Domain` row, and neither is a placeholder | Pass | `Language | en` and `Domain | it` are in the Metadata table. |
|
||||||
|
| 2 | `Language` is a BCP 47 code and `Domain` is a value from the registry's domain list | Pass | `en` is a BCP 47 code; `it` is in the registry's domain list. |
|
||||||
|
| 3 | The content (prose and table cells) is written in the stated language | Pass | All prose and table cells are English. Checked by the stand-in reviewer, who reads English. |
|
||||||
|
| 4 | The register matches the one the registry gives for the artifact type | Pass | The registry gives IT Professional English for this type; the text matches it. |
|
||||||
|
| 5 | Domain terms are the PO terms of the domain's dictionary, with no synonyms | Pass | No dictionary (`DICT`) exists; the terms user, word, letter and code word are used consistently with no synonyms. Checked by the stand-in; open to challenge. |
|
||||||
|
| 6 | Metadata keys, section headings, IDs and statuses are in English | Pass | Metadata keys, headings, IDs and statuses are English. |
|
||||||
|
| 7 | No translated twin (`<name>.<language>.md`) exists beside the document | Pass | No translated twin exists. |
|
||||||
|
| 8 | A change of language or domain since the previous accepted version has a Version History row and was reviewed again | Pass | First version; no change of language or domain. |
|
||||||
|
| 9 | A reviewer competent in the domain, and in the language, has confirmed that the domain terms are used correctly | Pass | Software and IT domain, English language; the reviewer stood in for (S01) reads both. A person may challenge this in the run summary. |
|
||||||
|
| 10 | Abbreviations are spelled out on first use, in the stated language | Pass | Abbreviations are spelled out on first use or are identifiers. |
|
||||||
|
|
||||||
|
## Overall Verdict
|
||||||
|
|
||||||
|
Go — every Mandatory criterion of QC-UCD-001 and QC-LANG-001 passes.
|
||||||
|
|
||||||
|
## Action Items
|
||||||
|
|
||||||
|
| Action | Owner | Due |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| None | S01 | n/a |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[UCD-001]: ../../use-case-diagram.md
|
||||||
|
[QC-UCD-001]: ../../../framework/qc/artifacts/qc-use-case-diagram.md
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
# SQA Review Record RC-011: US-001
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | RC-011 |
|
||||||
|
| CrossReference | [US-001], [QC-US-001] |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Review of US-001 | [80ec1bc] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Artifact Under Review
|
||||||
|
|
||||||
|
- Instance reviewed: [US-001]
|
||||||
|
- Checklist used: [QC-US-001]
|
||||||
|
- Scope: full review
|
||||||
|
- Language and domain: en / it
|
||||||
|
- Language reviewer: none
|
||||||
|
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`)
|
||||||
|
|
||||||
|
## Checklist Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | Follows INVEST criteria (Independent, Negotiable, Valuable, Estimable, Small, Testable) | Pass | INVEST check line in the document; one story, one console interaction. |
|
||||||
|
| 2 | Written in "As a / I want / So that" form | Pass | As a / I want / so that. |
|
||||||
|
| 3 | Clear, testable acceptance criteria are included | Pass | Four Given/When/Then criteria, each a pytest case. |
|
||||||
|
| 4 | Traceable to a use case or epic | Pass | Traces to [UC-001] and the epic [MIL-002]. |
|
||||||
|
| 5 | Story is sized to fit within a single iteration | Pass | Fits one iteration. |
|
||||||
|
| 6 | Story statement avoids technical implementation detail | Pass | No implementation detail. |
|
||||||
|
| 7 | Role named in the story matches an actor defined in the Use Case Diagram | Pass | Role `User` is the actor of [UCD-001]. |
|
||||||
|
|
||||||
|
## Language and Domain Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | The Metadata table has a `Language` row and a `Domain` row, and neither is a placeholder | Pass | `Language | en` and `Domain | it` are in the Metadata table. |
|
||||||
|
| 2 | `Language` is a BCP 47 code and `Domain` is a value from the registry's domain list | Pass | `en` is a BCP 47 code; `it` is in the registry's domain list. |
|
||||||
|
| 3 | The content (prose and table cells) is written in the stated language | Pass | All prose and table cells are English. Checked by the stand-in reviewer, who reads English. |
|
||||||
|
| 4 | The register matches the one the registry gives for the artifact type | Pass | The registry gives IT Professional English for this type; the text matches it. |
|
||||||
|
| 5 | Domain terms are the PO terms of the domain's dictionary, with no synonyms | Pass | No dictionary (`DICT`) exists; the terms user, word, letter and code word are used consistently with no synonyms. Checked by the stand-in; open to challenge. |
|
||||||
|
| 6 | Metadata keys, section headings, IDs and statuses are in English | Pass | Metadata keys, headings, IDs and statuses are English. |
|
||||||
|
| 7 | No translated twin (`<name>.<language>.md`) exists beside the document | Pass | No translated twin exists. |
|
||||||
|
| 8 | A change of language or domain since the previous accepted version has a Version History row and was reviewed again | Pass | First version; no change of language or domain. |
|
||||||
|
| 9 | A reviewer competent in the domain, and in the language, has confirmed that the domain terms are used correctly | Pass | Software and IT domain, English language; the reviewer stood in for (S01) reads both. A person may challenge this in the run summary. |
|
||||||
|
| 10 | Abbreviations are spelled out on first use, in the stated language | Pass | Abbreviations are spelled out on first use or are identifiers. |
|
||||||
|
|
||||||
|
## Overall Verdict
|
||||||
|
|
||||||
|
Go — every Mandatory criterion of QC-US-001 and QC-LANG-001 passes.
|
||||||
|
|
||||||
|
## Action Items
|
||||||
|
|
||||||
|
| Action | Owner | Due |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| None | S01 | n/a |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[US-001]: ../../user-stories.md
|
||||||
|
[QC-US-001]: ../../../framework/qc/artifacts/qc-user-story.md
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
# SQA Review Record RC-012: UC-001
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | RC-012 |
|
||||||
|
| CrossReference | [UC-001], [QC-UC-001] |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Review of UC-001 | [80ec1bc] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Artifact Under Review
|
||||||
|
|
||||||
|
- Instance reviewed: [UC-001]
|
||||||
|
- Checklist used: [QC-UC-001]
|
||||||
|
- Scope: full review
|
||||||
|
- Language and domain: en / it
|
||||||
|
- Language reviewer: none
|
||||||
|
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`)
|
||||||
|
|
||||||
|
## Checklist Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | Consists of a single, concise paragraph summarizing only the primary success scenario | N-A | Format is Fully Dressed, not Brief. |
|
||||||
|
| 2 | Written as an informal multi-paragraph narrative; may mention some alternate flows without formal structure | N-A | Format is Fully Dressed, not Casual. |
|
||||||
|
| 3 | All standard sections are present: actors, preconditions, postconditions, main success scenario, alternative/exception flows | Pass | Scope, level, actor, stakeholders, pre- and postconditions, main scenario, extensions, rules and open issues are present. |
|
||||||
|
| 4 | Preconditions and postconditions are explicitly defined | Pass | Preconditions and postconditions are stated. |
|
||||||
|
| 5 | Primary actor is explicitly stated | Pass | Primary actor: User. |
|
||||||
|
| 6 | Stakeholders and their interests are stated | Pass | S01 and S02 with their interests. |
|
||||||
|
| 7 | Main success scenario is written as clear, numbered steps | Pass | Four numbered steps. |
|
||||||
|
| 8 | Alternative/exception flows correctly reference `<<include>>`/`<<extend>>` use cases where relevant, per UML 2.5.1 | N-A | No other use case exists, so no include or extend is relevant; the alternative flow 3a is a plain extension. |
|
||||||
|
| 9 | Explicit business rules are captured per step where applicable, rather than embedded loosely in narrative text | Pass | A Special Requirements table gives a rule per step. |
|
||||||
|
| 10 | Naming of actors and use case title is consistent with the corresponding Use Case Diagram and User Stories | Pass | Actor and title match [UCD-001] and [US-001]. |
|
||||||
|
| 11 | Scope/level (e.g. summary, user-goal, subfunction) is explicitly stated | Pass | Level: user-goal; scope: NATO alphabet tool. |
|
||||||
|
| 12 | Use case is written from the actor's goal perspective, free of UI or implementation detail | Pass | Written from the goal of the User, with no interface detail. |
|
||||||
|
|
||||||
|
## Language and Domain Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | The Metadata table has a `Language` row and a `Domain` row, and neither is a placeholder | Pass | `Language | en` and `Domain | it` are in the Metadata table. |
|
||||||
|
| 2 | `Language` is a BCP 47 code and `Domain` is a value from the registry's domain list | Pass | `en` is a BCP 47 code; `it` is in the registry's domain list. |
|
||||||
|
| 3 | The content (prose and table cells) is written in the stated language | Pass | All prose and table cells are English. Checked by the stand-in reviewer, who reads English. |
|
||||||
|
| 4 | The register matches the one the registry gives for the artifact type | Pass | The registry gives IT Professional English for this type; the text matches it. |
|
||||||
|
| 5 | Domain terms are the PO terms of the domain's dictionary, with no synonyms | Pass | No dictionary (`DICT`) exists; the terms user, word, letter and code word are used consistently with no synonyms. Checked by the stand-in; open to challenge. |
|
||||||
|
| 6 | Metadata keys, section headings, IDs and statuses are in English | Pass | Metadata keys, headings, IDs and statuses are English. |
|
||||||
|
| 7 | No translated twin (`<name>.<language>.md`) exists beside the document | Pass | No translated twin exists. |
|
||||||
|
| 8 | A change of language or domain since the previous accepted version has a Version History row and was reviewed again | Pass | First version; no change of language or domain. |
|
||||||
|
| 9 | A reviewer competent in the domain, and in the language, has confirmed that the domain terms are used correctly | Pass | Software and IT domain, English language; the reviewer stood in for (S01) reads both. A person may challenge this in the run summary. |
|
||||||
|
| 10 | Abbreviations are spelled out on first use, in the stated language | Pass | Abbreviations are spelled out on first use or are identifiers. |
|
||||||
|
|
||||||
|
## Overall Verdict
|
||||||
|
|
||||||
|
Go — every applicable Mandatory criterion passes. The task summary of MIL-002 said "brief"; the use case is Fully Dressed so that the system sequence diagram can follow its steps one by one.
|
||||||
|
|
||||||
|
## Action Items
|
||||||
|
|
||||||
|
| Action | Owner | Due |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| None | S01 | n/a |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[UC-001]: ../../uc-001/uc.md
|
||||||
|
[QC-UC-001]: ../../../framework/qc/artifacts/qc-use-case.md
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
# SQA Review Record RC-013: SSD-001
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | RC-013 |
|
||||||
|
| CrossReference | [SSD-001], [QC-SSD-001] |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Review of SSD-001 | [80ec1bc] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Artifact Under Review
|
||||||
|
|
||||||
|
- Instance reviewed: [SSD-001]
|
||||||
|
- Checklist used: [QC-SSD-001]
|
||||||
|
- Scope: full review
|
||||||
|
- Language and domain: en / it
|
||||||
|
- Language reviewer: none
|
||||||
|
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`)
|
||||||
|
|
||||||
|
## Checklist Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | Input/output messages match the corresponding Use Case's main success scenario step-for-step | Pass | Messages requestWord and spellWord cover steps 1 to 4; the table maps each message to its use case steps. |
|
||||||
|
| 2 | Actor and System are treated strictly as black boxes (system shown as `:System`) | Pass | The system is `:System`; no internal objects. |
|
||||||
|
| 3 | Object creation/destruction of the System instance handled explicitly where relevant | Pass | Lifecycle notes state one session per start. |
|
||||||
|
| 4 | Return values are shown for operations that produce one, using dashed return arrows | Pass | Dashed return arrows for prompt and codeWords. |
|
||||||
|
| 5 | Alternate/exceptional flows are represented separately (or explicitly out of scope noted) | Pass | The alternate flow 3a has its own diagram. |
|
||||||
|
| 6 | Message names are verb phrases consistent with the use case's system responsibilities | Pass | requestWord and spellWord are verb phrases. |
|
||||||
|
| 7 | Diagram references the specific Use Case (name and ID) it depicts | Pass | The Source Use Case section names Spell a Word and [UC-001]. |
|
||||||
|
|
||||||
|
## Language and Domain Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | The Metadata table has a `Language` row and a `Domain` row, and neither is a placeholder | Pass | `Language | en` and `Domain | it` are in the Metadata table. |
|
||||||
|
| 2 | `Language` is a BCP 47 code and `Domain` is a value from the registry's domain list | Pass | `en` is a BCP 47 code; `it` is in the registry's domain list. |
|
||||||
|
| 3 | The content (prose and table cells) is written in the stated language | Pass | All prose and table cells are English. Checked by the stand-in reviewer, who reads English. |
|
||||||
|
| 4 | The register matches the one the registry gives for the artifact type | Pass | The registry gives IT Professional English for this type; the text matches it. |
|
||||||
|
| 5 | Domain terms are the PO terms of the domain's dictionary, with no synonyms | Pass | No dictionary (`DICT`) exists; the terms user, word, letter and code word are used consistently with no synonyms. Checked by the stand-in; open to challenge. |
|
||||||
|
| 6 | Metadata keys, section headings, IDs and statuses are in English | Pass | Metadata keys, headings, IDs and statuses are English. |
|
||||||
|
| 7 | No translated twin (`<name>.<language>.md`) exists beside the document | Pass | No translated twin exists. |
|
||||||
|
| 8 | A change of language or domain since the previous accepted version has a Version History row and was reviewed again | Pass | First version; no change of language or domain. |
|
||||||
|
| 9 | A reviewer competent in the domain, and in the language, has confirmed that the domain terms are used correctly | Pass | Software and IT domain, English language; the reviewer stood in for (S01) reads both. A person may challenge this in the run summary. |
|
||||||
|
| 10 | Abbreviations are spelled out on first use, in the stated language | Pass | Abbreviations are spelled out on first use or are identifiers. |
|
||||||
|
|
||||||
|
## Overall Verdict
|
||||||
|
|
||||||
|
Go — every Mandatory criterion of QC-SSD-001 and QC-LANG-001 passes.
|
||||||
|
|
||||||
|
## Action Items
|
||||||
|
|
||||||
|
| Action | Owner | Due |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| None | S01 | n/a |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[SSD-001]: ../../uc-001/ssd.md
|
||||||
|
[QC-SSD-001]: ../../../framework/qc/artifacts/qc-ssd.md
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
# SQA Review Record RC-014: PY-002
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | RC-014 |
|
||||||
|
| CrossReference | [PY-002], [QC-PY-001] |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Review of PY-002 | [80ec1bc] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Artifact Under Review
|
||||||
|
|
||||||
|
- Instance reviewed: [PY-002]
|
||||||
|
- Checklist used: [QC-PY-001]
|
||||||
|
- Scope: full review
|
||||||
|
- Language and domain: n/a (technical type)
|
||||||
|
- Language reviewer: none
|
||||||
|
- Mode: autonomous, not independent (the reviewer is `AI as stand-in for S01`)
|
||||||
|
|
||||||
|
## Checklist Results
|
||||||
|
|
||||||
|
| # | Criterion | Status | Evidence/Notes |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | Packages, modules, functions, variables, classes and constants follow PEP 8 casing (`snake_case`, `PascalCase`, `UPPER_SNAKE`) | Pass | ruff rule set N passes; modules snake_case, classes PascalCase, `InvalidWordError` ends in Error; ruff rule set N passes. |
|
||||||
|
| 2 | Names state purpose in the domain's language; no unexplained abbreviations, no single-letter names outside tiny scopes | Pass | Names state purpose: `generate_phonetic`, `spell_word`, `load_nato_dict`, `TerminalConsole`. |
|
||||||
|
| 3 | Code is produced by the project's formatter and passes its linter with no unexplained suppressions | Pass | ruff 0.17.0 check and format pass; no suppressions. |
|
||||||
|
| 4 | Every function and method signature is type-annotated, including `-> None` | Pass | All signatures annotated; mypy --strict passes. |
|
||||||
|
| 5 | No bare `except:`, no swallowed exceptions; specific exceptions are raised and the cause is kept (`raise ... from`) | Pass | `spell_word` catches the specific `KeyError` and raises `InvalidWordError` `from` it; `generate_phonetic` catches only `InvalidWordError`; the console adapter maps only EOFError and KeyboardInterrupt to `InputClosedError`; no bare except. |
|
||||||
|
| 6 | No mutable default arguments and no shadowed builtins | Pass | No mutable defaults; `path` defaults to None. |
|
||||||
|
| 7 | Files, locks and connections are managed with context managers | Pass | The CSV is read inside a `with` block. |
|
||||||
|
| 8 | Public modules, classes and functions have docstrings that say what, not how | Pass | Every module, class, function and constant has a Doxygen docstring; doxygen reports 0 warnings. |
|
||||||
|
| 9 | Logging uses `logging`, not `print`; no secrets or personal data in log output | Pass | `print` and `input` are confined to `adapters/console.py` because the console is the program's output; there is no logging and no secret or personal data. |
|
||||||
|
| 10 | Classes and operations trace to the Design Class Diagram they implement; deviations are recorded | N-A | No design class diagram exists; MIL-002 plans none (the SSD and use case are the design artifacts). Classes follow the ports in `application/ports.py`. |
|
||||||
|
| 11 | Tests exist for new behaviour, are named for the behaviour, and do not depend on order or the network | Pass | 49 tests named for behaviour; `tmp_path` and fakes; no network; order independent. |
|
||||||
|
| 12 | Type checker runs in strict mode without errors; `Any` is justified in a comment | Pass | mypy --strict: no issues in 18 files; no `Any`. |
|
||||||
|
| 13 | Dependencies are declared and pinned in the project's dependency file, none unused | Pass | No runtime dependencies; development tools pinned with `==`. |
|
||||||
|
| 14 | Each piece of knowledge (a business rule, constant, format, validation or query) is defined in one place; code is merged only where it expresses the same knowledge, not where it merely looks alike | Pass | Each literal is defined once in `constants.py`; the letter mapping is defined once in the CSV. |
|
||||||
|
| 15 | Imports point inward: business-rule modules import no framework, database, UI or delivery-mechanism code, and there are no import cycles | Pass | import-linter contract `Dependencies point inward` is kept; no cycles. |
|
||||||
|
| 16 | SOLID holds: a class or module has one reason to change; new behaviour is added by extension, not by editing a type test in several places; subclasses honour the contract of their base; protocols are narrow; high-level code depends on protocols or abstract types and receives its implementations | Pass | `WordConsole` is a narrow Protocol; `generate_phonetic` depends on it and `TerminalConsole` implements it. |
|
||||||
|
|
||||||
|
## Overall Verdict
|
||||||
|
|
||||||
|
Go — every Mandatory criterion of QC-PY-001 passes or is not applicable (criterion 10: no design class diagram is planned). `generate_phonetic` takes the alphabet and the console as parameters because the application layer may not read files or call `input`; the assignment's name is kept. The `try`/`except KeyError` is in the domain function `spell_word` and the retry loop is in `generate_phonetic`.
|
||||||
|
|
||||||
|
## Action Items
|
||||||
|
|
||||||
|
| Action | Owner | Due |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| None | S01 | n/a |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[PY-002]: ../../../src/nato_phonetic_alphabet/main.py
|
||||||
|
[QC-PY-001]: ../../../framework/qc/code/qc-programming-python.md
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
# Traceability Matrix
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | TM-001 |
|
||||||
|
| CrossReference | [BC-001] |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version, rows for RC-001 to RC-014 | [b69a604] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
Tracks backward and forward links between artifact instances so that the cross-artifact traceability can be checked. A row is added or updated whenever an artifact instance is created or reviewed.
|
||||||
|
|
||||||
|
## Traceability Table
|
||||||
|
|
||||||
|
| Artifact Instance | Type | Language | Domain | Upstream (Backward Link) | Downstream (Forward Link) | Last Reviewed (RC-ID) |
|
||||||
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
| [BC-001] | Business Case | en | it | - | [SA-001], [PP-001], [MIL-001], [MIL-002], [MIL-003] | [RC-001] |
|
||||||
|
| [SA-001] | Stakeholder Analysis | en | it | [BC-001] | [PP-001] | [RC-002] |
|
||||||
|
| [PP-001] | Project Plan | en | it | [BC-001], [SA-001] | [MIL-001], [MIL-002], [MIL-003] | - |
|
||||||
|
| [MIL-001] | Milestone | en | it | [BC-001], [PP-001] | [MIL-002], [ADR-0001], [ADR-0002] | [RC-003] |
|
||||||
|
| [MIL-002] | Milestone | en | it | [BC-001], [MIL-001] | [MIL-003], [US-001], [UC-001], [PY-002] | [RC-004] |
|
||||||
|
| [MIL-003] | Milestone | en | it | [BC-001], [MIL-002] | - | [RC-005] |
|
||||||
|
| [ADR-0001] | ADR | - | - | [BC-001], [SA-001] | [PY-001] | [RC-006] |
|
||||||
|
| [ADR-0002] | ADR | - | - | [BC-001] | - | [RC-007] |
|
||||||
|
| [WF-001] | CI workflow | - | - | [MIL-001] | - | [RC-008] |
|
||||||
|
| [UCD-001] | Use Case Diagram | en | it | [SA-001], [BC-001] | [US-001], [UC-001] | [RC-010] |
|
||||||
|
| [US-001] | User Story | en | it | [UCD-001], [MIL-002] | [UC-001] | [RC-011] |
|
||||||
|
| [UC-001] | Use Case | en | it | [UCD-001], [US-001] | [SSD-001], [PY-002] | [RC-012] |
|
||||||
|
| [SSD-001] | System Sequence Diagram | en | it | [UC-001] | [PY-002] | [RC-013] |
|
||||||
|
| [PY-002] | Python source | - | - | [UC-001], [SSD-001], [ADR-0001] | - | [RC-014] |
|
||||||
|
| [PY-001] | Python source | - | - | [ADR-0001], [MIL-001] | - | [RC-009] |
|
||||||
|
|
||||||
|
## Coverage Notes
|
||||||
|
|
||||||
|
- `-` in Upstream means foundational; in Downstream it means nothing is built on it yet; in Last Reviewed it means no review record exists.
|
||||||
|
- PP-001 has no QC checklist yet; it is accepted by the Product Owner's stand-in.
|
||||||
|
- WF-001 and PY-001 are labels for reviewed code instances (no artifact file).
|
||||||
|
- PY-002 is the label of the reviewed converter code.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[BC-001]: ../business-case.md
|
||||||
|
[MIL-001]: ../milestones/mil-001-repository-foundation.md
|
||||||
|
[MIL-002]: ../milestones/mil-002-nato-converter.md
|
||||||
|
[MIL-003]: ../milestones/mil-003-documentation-and-publication.md
|
||||||
|
[PP-001]: ../project-plan.md
|
||||||
|
[RC-001]: ./reviews/rc-001-business-case.md
|
||||||
|
[RC-002]: ./reviews/rc-002-stakeholder-analysis.md
|
||||||
|
[RC-003]: ./reviews/rc-003-mil-001.md
|
||||||
|
[RC-004]: ./reviews/rc-004-mil-002.md
|
||||||
|
[RC-005]: ./reviews/rc-005-mil-003.md
|
||||||
|
[SA-001]: ../stakeholder-analysis.md
|
||||||
|
[ADR-0001]: ../adr/adr-0001-read-nato-data-with-csv-module.md
|
||||||
|
[ADR-0002]: ../adr/adr-0002-skip-analysis-artifacts.md
|
||||||
|
[WF-001]: ../../.gitea/workflows/ci.yml
|
||||||
|
[PY-001]: ../../src/nato_phonetic_alphabet/constants.py
|
||||||
|
[RC-006]: ./reviews/rc-006-adr-0001.md
|
||||||
|
[RC-007]: ./reviews/rc-007-adr-0002.md
|
||||||
|
[RC-008]: ./reviews/rc-008-ci-workflow.md
|
||||||
|
[RC-009]: ./reviews/rc-009-python-skeleton.md
|
||||||
|
[UCD-001]: ../use-case-diagram.md
|
||||||
|
[US-001]: ../user-stories.md
|
||||||
|
[UC-001]: ../uc-001/uc.md
|
||||||
|
[SSD-001]: ../uc-001/ssd.md
|
||||||
|
[PY-002]: ../../src/nato_phonetic_alphabet/main.py
|
||||||
|
[RC-010]: ./reviews/rc-010-ucd-001.md
|
||||||
|
[RC-011]: ./reviews/rc-011-us-001.md
|
||||||
|
[RC-012]: ./reviews/rc-012-uc-001.md
|
||||||
|
[RC-013]: ./reviews/rc-013-ssd-001.md
|
||||||
|
[RC-014]: ./reviews/rc-014-python-converter.md
|
||||||
|
[b69a604]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/b69a604341251be410672cee93910e528eecaef8
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
# SSD-001 Spell a Word
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | SSD-001 |
|
||||||
|
| CrossReference | [UC-001] |
|
||||||
|
| Language | en |
|
||||||
|
| Domain | it |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version, reviewed in RC-013 | [80ec1bc] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Source Use Case
|
||||||
|
|
||||||
|
Spell a Word ([UC-001]) — scenario: main success scenario. The alternate flow 3a (invalid character) is drawn separately below.
|
||||||
|
|
||||||
|
## Diagram
|
||||||
|
|
||||||
|
```plantuml
|
||||||
|
@startuml
|
||||||
|
actor User as U
|
||||||
|
participant ":System" as S
|
||||||
|
U -> S : requestWord()
|
||||||
|
S --> U : prompt
|
||||||
|
U -> S : spellWord(word)
|
||||||
|
S --> U : codeWords
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternate flow 3a, a word with a character that is not a letter:
|
||||||
|
|
||||||
|
```plantuml
|
||||||
|
@startuml
|
||||||
|
actor User as U
|
||||||
|
participant ":System" as S
|
||||||
|
U -> S : spellWord(word)
|
||||||
|
S --> U : rejection(only letters allowed)
|
||||||
|
S --> U : prompt
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
## System Operations
|
||||||
|
|
||||||
|
| Step | Message | Parameters | Return | Use case step |
|
||||||
|
| --- | --- | --- | --- | --- |
|
||||||
|
| 1 | requestWord | none | prompt asking for a word | 1, 2 |
|
||||||
|
| 2 | spellWord | word | the list of code words, or a rejection for a non-letter | 3, 4 and 3a |
|
||||||
|
|
||||||
|
## Lifecycle Notes
|
||||||
|
|
||||||
|
The tool runs one session per start; it keeps no state between words. The data is loaded once when the session starts.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[UC-001]: ./uc.md
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
# UC-001 Spell a Word
|
||||||
|
|
||||||
|
## Metadata
|
||||||
|
| Key | Value |
|
||||||
|
| --- | --- |
|
||||||
|
| ID | UC-001 |
|
||||||
|
| CrossReference | [UCD-001], [US-001], [SA-001] |
|
||||||
|
| Language | en |
|
||||||
|
| Domain | it |
|
||||||
|
|
||||||
|
## Version History
|
||||||
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
|
| --- | --- | --- | --- | --- | --- |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version, reviewed in RC-012 | [80ec1bc] |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Format:** Fully Dressed
|
||||||
|
|
||||||
|
## Fully Dressed
|
||||||
|
|
||||||
|
- **Scope:** NATO alphabet tool
|
||||||
|
- **Level:** user-goal
|
||||||
|
- **Primary Actor:** User, as named in [UCD-001]
|
||||||
|
- **Stakeholders and Interests:**
|
||||||
|
- S01 — a correct result for every letter, kept simple
|
||||||
|
- S02 — a readable behaviour that can be compared with their own solution
|
||||||
|
- **Preconditions:** the NATO alphabet data is available to the tool
|
||||||
|
- **Postconditions (success guarantee):** the User has seen the NATO code word of each letter of the word, in the order of the letters
|
||||||
|
|
||||||
|
### Main Success Scenario
|
||||||
|
|
||||||
|
1. The User starts the tool.
|
||||||
|
2. The tool asks for a word.
|
||||||
|
3. The User enters a word made of letters.
|
||||||
|
4. The tool shows the NATO code word of each letter, in order.
|
||||||
|
|
||||||
|
### Extensions (Alternative / Exception Flows)
|
||||||
|
|
||||||
|
- 3a. The word contains a character that is not a letter:
|
||||||
|
1. The tool catches the failed lookup (exception handling), tells the User to enter only letters of the alphabet and does not crash.
|
||||||
|
2. The tool asks for a word again (back to step 2).
|
||||||
|
|
||||||
|
### Special Requirements / Business Rules
|
||||||
|
|
||||||
|
| Step | Rule |
|
||||||
|
| --- | --- |
|
||||||
|
| 3 | Upper-case and lower-case letters give the same result |
|
||||||
|
| 4 | Each letter A to Z maps to exactly one code word from the supplied alphabet |
|
||||||
|
|
||||||
|
### Open Issues
|
||||||
|
|
||||||
|
- None.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[UCD-001]: ../use-case-diagram.md
|
||||||
|
[US-001]: ../user-stories.md
|
||||||
|
[SA-001]: ../stakeholder-analysis.md
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
@@ -11,7 +11,8 @@
|
|||||||
## Version History
|
## Version History
|
||||||
| Date | Status | Author | Reviewer | Change | Commit |
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
| --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- |
|
||||||
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version, adapted from the 026 NATO alphabet project | pending |
|
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version, adapted from the 026 NATO alphabet project | [1da8981] |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Reviewed in RC-010 | [80ec1bc] |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -56,3 +57,5 @@ U --> UC1
|
|||||||
[BC-001]: ./business-case.md
|
[BC-001]: ./business-case.md
|
||||||
[US-001]: ./user-stories.md
|
[US-001]: ./user-stories.md
|
||||||
[UC-001]: ./uc-001/uc.md
|
[UC-001]: ./uc-001/uc.md
|
||||||
|
[1da8981]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/1da8981
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
## Version History
|
## Version History
|
||||||
| Date | Status | Author | Reviewer | Change | Commit |
|
| Date | Status | Author | Reviewer | Change | Commit |
|
||||||
| --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- |
|
||||||
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version, adapted from the 026 NATO alphabet project | pending |
|
| 2026-10-14 | Proposed | Jens Tirsvad Nielsen | AI as stand-in for S01 | Initial version, adapted from the 026 NATO alphabet project | [1da8981] |
|
||||||
|
| 2026-10-14 | Accepted | Jens Tirsvad Nielsen | AI as stand-in for S01 | Reviewed in RC-011 | [80ec1bc] |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -46,3 +47,5 @@ Independent (no other story is needed), Negotiable (wording of the messages is o
|
|||||||
[BC-001]: ./business-case.md
|
[BC-001]: ./business-case.md
|
||||||
[MIL-002]: ./milestones/mil-002-nato-converter.md
|
[MIL-002]: ./milestones/mil-002-nato-converter.md
|
||||||
[UC-001]: ./uc-001/uc.md
|
[UC-001]: ./uc-001/uc.md
|
||||||
|
[1da8981]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/1da8981
|
||||||
|
[80ec1bc]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/commit/80ec1bc3640e1aa2ad1f152b9f71df39fa71c2d1
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# Udvikling
|
||||||
|
|
||||||
|
🌐 [English](Development) · **Dansk** · [Bahasa Melayu](Development-ms)
|
||||||
|
|
||||||
|
Sæt projektet op først ([Installation](Install-da)). Udvidelsen `dev` installerer pytest, ruff, mypy og import-linter.
|
||||||
|
|
||||||
|
## Kør testene
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pytest
|
||||||
|
```
|
||||||
|
|
||||||
|
## Kør de kontroller, CI kører
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m ruff check .
|
||||||
|
python -m mypy
|
||||||
|
lint-imports
|
||||||
|
```
|
||||||
|
|
||||||
|
## Byg kildedokumentationen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
doxygen Doxyfile
|
||||||
|
```
|
||||||
|
|
||||||
|
Åbn `build/html/index.html`. Installér Doxygen fra [doxygen.nl](https://www.doxygen.nl/) eller din pakkehåndtering.
|
||||||
|
|
||||||
|
## Sådan virker exception handling
|
||||||
|
|
||||||
|
`spell_word` (i `domain/spelling.py`) slår hvert bogstav op i ordbogen i en `try`-blok. Et tegn, der ikke findes i alfabetet, giver en `KeyError`, som `except`-blokken gør til en `InvalidWordError`. `generate_phonetic` (i `application/phonetic.py`) fanger fejlen, beder brugeren skrive kun bogstaver og spørger igen, indtil ordet er gyldigt.
|
||||||
|
|
||||||
|
## Kodens opbygning
|
||||||
|
|
||||||
|
| Mappe | Indhold |
|
||||||
|
| --- | --- |
|
||||||
|
| `src/nato_phonetic_alphabet/domain/` | Staveregelen, uden input og output |
|
||||||
|
| `src/nato_phonetic_alphabet/application/` | Use casen og dens porte |
|
||||||
|
| `src/nato_phonetic_alphabet/adapters/` | CSV-læseren og konsollen |
|
||||||
|
| `src/nato_phonetic_alphabet/constants.py` | Alle programmets konstanter |
|
||||||
|
| `tests/` | pytest-tests, som spejler `src/` |
|
||||||
|
|
||||||
|
Afhængigheder peger indad: adapters kender applikationen, applikationen kender domænet. import-linter håndhæver det.
|
||||||
|
|
||||||
|
## Pull requests
|
||||||
|
|
||||||
|
Én gren og én pull request pr. milepæl; CI skal være grøn. Projektet følger SQA- og QC-frameworket i `framework/`; se `docs/` for planen og review-optegnelserne.
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# Pembangunan
|
||||||
|
|
||||||
|
🌐 [English](Development) · [Dansk](Development-da) · **Bahasa Melayu**
|
||||||
|
|
||||||
|
Sediakan projek dahulu ([Pemasangan](Install-ms)). Pilihan tambahan `dev` memasang pytest, ruff, mypy dan import-linter.
|
||||||
|
|
||||||
|
## Jalankan ujian
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pytest
|
||||||
|
```
|
||||||
|
|
||||||
|
## Jalankan semakan yang dijalankan oleh CI
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m ruff check .
|
||||||
|
python -m mypy
|
||||||
|
lint-imports
|
||||||
|
```
|
||||||
|
|
||||||
|
## Bina dokumentasi sumber
|
||||||
|
|
||||||
|
```bash
|
||||||
|
doxygen Doxyfile
|
||||||
|
```
|
||||||
|
|
||||||
|
Buka `build/html/index.html`. Pasang Doxygen dari [doxygen.nl](https://www.doxygen.nl/) atau pengurus pakej anda.
|
||||||
|
|
||||||
|
## Cara pengendalian pengecualian berfungsi
|
||||||
|
|
||||||
|
`spell_word` (dalam `domain/spelling.py`) mencari setiap huruf dalam kamus di dalam blok `try`. Aksara yang tiada dalam abjad menimbulkan `KeyError`, yang ditukar oleh blok `except` kepada `InvalidWordError`. `generate_phonetic` (dalam `application/phonetic.py`) menangkap ralat itu, meminta pengguna memasukkan huruf sahaja dan bertanya semula sehingga perkataan itu sah.
|
||||||
|
|
||||||
|
## Susun atur kod
|
||||||
|
|
||||||
|
| Folder | Kandungan |
|
||||||
|
| --- | --- |
|
||||||
|
| `src/nato_phonetic_alphabet/domain/` | Peraturan ejaan, tanpa input dan output |
|
||||||
|
| `src/nato_phonetic_alphabet/application/` | Kes guna dan portnya |
|
||||||
|
| `src/nato_phonetic_alphabet/adapters/` | Pembaca CSV dan konsol |
|
||||||
|
| `src/nato_phonetic_alphabet/constants.py` | Semua pemalar program |
|
||||||
|
| `tests/` | Ujian pytest, mencerminkan `src/` |
|
||||||
|
|
||||||
|
Kebergantungan menghala ke dalam: adapter mengenali aplikasi, aplikasi mengenali domain. import-linter menguatkuasakannya.
|
||||||
|
|
||||||
|
## Pull request
|
||||||
|
|
||||||
|
Satu cabang dan satu pull request bagi setiap milestone; CI mesti hijau. Projek ini mengikut rangka kerja SQA dan QC dalam `framework/`; lihat `docs/` untuk pelan dan rekod semakan.
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# Development
|
||||||
|
|
||||||
|
🌐 **English** · [Dansk](Development-da) · [Bahasa Melayu](Development-ms)
|
||||||
|
|
||||||
|
Set up the project first ([Install](Install)). The `dev` extra installs pytest, ruff, mypy and import-linter.
|
||||||
|
|
||||||
|
## Run the tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pytest
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run the checks that CI runs
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m ruff check .
|
||||||
|
python -m mypy
|
||||||
|
lint-imports
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build the source documentation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
doxygen Doxyfile
|
||||||
|
```
|
||||||
|
|
||||||
|
Open `build/html/index.html`. Install Doxygen from [doxygen.nl](https://www.doxygen.nl/) or your package manager.
|
||||||
|
|
||||||
|
## How the exception handling works
|
||||||
|
|
||||||
|
`spell_word` (in `domain/spelling.py`) looks every letter up in the dictionary inside a `try` block. A character that is not in the alphabet raises a `KeyError`, which the `except` block turns into an `InvalidWordError`. `generate_phonetic` (in `application/phonetic.py`) catches that error, tells the user to enter letters only and asks again until the word is valid.
|
||||||
|
|
||||||
|
## Code layout
|
||||||
|
|
||||||
|
| Folder | Content |
|
||||||
|
| --- | --- |
|
||||||
|
| `src/nato_phonetic_alphabet/domain/` | The spelling rule, with no input or output |
|
||||||
|
| `src/nato_phonetic_alphabet/application/` | The use case and its ports |
|
||||||
|
| `src/nato_phonetic_alphabet/adapters/` | The CSV reader and the console |
|
||||||
|
| `src/nato_phonetic_alphabet/constants.py` | Every literal of the program |
|
||||||
|
| `tests/` | pytest tests, mirroring `src/` |
|
||||||
|
|
||||||
|
Dependencies point inward: adapters know the application, the application knows the domain. import-linter enforces it.
|
||||||
|
|
||||||
|
## Pull requests
|
||||||
|
|
||||||
|
One branch and one pull request per milestone; CI must be green. The project follows the SQA and QC framework in `framework/`; see `docs/` for the plan and the review records.
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Det fonetiske NATO-alfabet
|
||||||
|
|
||||||
|
🌐 [English](Home) · **Dansk** · [Bahasa Melayu](Home-ms)
|
||||||
|
|
||||||
|
Et konsolprogram, der staver et ord med det fonetiske NATO-alfabet. Det er opgaven fra dag 30 i Udemys "100 Days of Code: The Complete Python Pro Bootcamp" og viser exception handling: input, der ikke er et bogstav, fanges med `try` og `except` i stedet for at få programmet til at gå ned. Det kræver Python 3.13 eller nyere og har ingen runtime-afhængigheder.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
| Side | Læs den, når du vil |
|
||||||
|
| --- | --- |
|
||||||
|
| [Installation](Install-da) | Oprette et lokalt `.venv` og installere projektet på Windows, Linux eller macOS |
|
||||||
|
| [Brug](Usage-da) | Køre programmet og læse dets output |
|
||||||
|
| [Udvikling](Development-da) | Køre testene og kontrollerne og bygge kildedokumentationen |
|
||||||
|
|
||||||
|
## Hvem det er til
|
||||||
|
|
||||||
|
- **Kursister**, der vil have en læsbar løsning med opgavens funktionsnavne (`load_nato_dict`, `generate_phonetic`) at sammenligne med deres egen.
|
||||||
|
- **GitHub-besøgende**, der vil se et lille, testet Python-projekt uden runtime-afhængigheder.
|
||||||
|
|
||||||
|
## Links
|
||||||
|
|
||||||
|
- [Repository](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet)
|
||||||
|
- [Fejl og ønsker](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/issues)
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Abjad fonetik NATO
|
||||||
|
|
||||||
|
🌐 [English](Home) · [Dansk](Home-da) · **Bahasa Melayu**
|
||||||
|
|
||||||
|
Alat konsol yang mengeja satu perkataan dengan abjad fonetik NATO. Ia ialah tugasan hari ke-30 dalam "100 Days of Code: The Complete Python Pro Bootcamp" di Udemy dan menunjukkan pengendalian pengecualian (exception handling): input yang bukan huruf ditangkap dengan `try` dan `except` dan bukannya menyebabkan program terhenti. Ia memerlukan Python 3.13 atau lebih baharu dan tidak mempunyai kebergantungan masa jalan.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
| Halaman | Baca apabila anda mahu |
|
||||||
|
| --- | --- |
|
||||||
|
| [Pemasangan](Install-ms) | Mencipta `.venv` setempat dan memasang projek di Windows, Linux atau macOS |
|
||||||
|
| [Penggunaan](Usage-ms) | Menjalankan program dan membaca outputnya |
|
||||||
|
| [Pembangunan](Development-ms) | Menjalankan ujian dan semakan serta membina dokumentasi sumber |
|
||||||
|
|
||||||
|
## Untuk siapa
|
||||||
|
|
||||||
|
- **Peserta kursus** yang mahukan penyelesaian yang mudah dibaca dengan nama fungsi tugasan (`load_nato_dict`, `generate_phonetic`) untuk dibandingkan dengan penyelesaian sendiri.
|
||||||
|
- **Pelawat GitHub** yang mahukan projek Python kecil yang diuji tanpa kebergantungan masa jalan.
|
||||||
|
|
||||||
|
## Pautan
|
||||||
|
|
||||||
|
- [Repositori](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet)
|
||||||
|
- [Penjejak isu](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/issues)
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# NATO phonetic alphabet
|
||||||
|
|
||||||
|
🌐 **English** · [Dansk](Home-da) · [Bahasa Melayu](Home-ms)
|
||||||
|
|
||||||
|
A console tool that spells a word with the NATO phonetic alphabet. It is the Day 30 assignment of Udemy's "100 Days of Code: The Complete Python Pro Bootcamp" and shows exception handling: input that is not a letter is caught with `try` and `except` instead of crashing the program. It needs Python 3.13 or newer and has no runtime dependencies.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
| Page | Read it when you want to |
|
||||||
|
| --- | --- |
|
||||||
|
| [Install](Install) | Create a local `.venv` and install the project on Windows, Linux or macOS |
|
||||||
|
| [Usage](Usage) | Run the program and read its output |
|
||||||
|
| [Development](Development) | Run the tests, the checks and build the source documentation |
|
||||||
|
|
||||||
|
## Who it is for
|
||||||
|
|
||||||
|
- **Course participants** who want a readable solution with the assignment's function names (`load_nato_dict`, `generate_phonetic`) to compare with their own.
|
||||||
|
- **GitHub viewers** who want a small, tested Python project with no runtime dependencies.
|
||||||
|
|
||||||
|
## Links
|
||||||
|
|
||||||
|
- [Repository](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet)
|
||||||
|
- [Issue tracker](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet/issues)
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
# Installation
|
||||||
|
|
||||||
|
🌐 [English](Install) · **Dansk** · [Bahasa Melayu](Install-ms)
|
||||||
|
|
||||||
|
## Det skal du bruge
|
||||||
|
|
||||||
|
- Python 3.13 eller nyere med modulet `venv`
|
||||||
|
- Git
|
||||||
|
|
||||||
|
## Trin
|
||||||
|
|
||||||
|
Alle systemer gør de samme fire ting: klon repository'et, opret et virtuelt miljø kaldet `.venv`, opgradér pip og installér projektet.
|
||||||
|
|
||||||
|
### Windows PowerShell
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
py -3.13 -m venv .venv
|
||||||
|
.\.venv\Scripts\Activate.ps1
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
Hvis PowerShell afviser aktiveringsscriptet, så kør først `Set-ExecutionPolicy -Scope Process RemoteSigned`. Det gælder kun for det vindue.
|
||||||
|
|
||||||
|
### Linux Debian
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install git python3 python3-venv
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install python@3.13 git
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
python3.13 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tjek at det virker
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m nato_phonetic_alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
Skriv et ord. Du skal se dets kodeord. Næste side: [Brug](Usage-da).
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
# Pemasangan
|
||||||
|
|
||||||
|
🌐 [English](Install) · [Dansk](Install-da) · **Bahasa Melayu**
|
||||||
|
|
||||||
|
## Apa yang diperlukan
|
||||||
|
|
||||||
|
- Python 3.13 atau lebih baharu dengan modul `venv`
|
||||||
|
- Git
|
||||||
|
|
||||||
|
## Langkah
|
||||||
|
|
||||||
|
Semua sistem melakukan empat perkara yang sama: klon repositori, cipta persekitaran maya bernama `.venv`, naik taraf pip dan pasang projek.
|
||||||
|
|
||||||
|
### Windows PowerShell
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
py -3.13 -m venv .venv
|
||||||
|
.\.venv\Scripts\Activate.ps1
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
Jika PowerShell enggan menjalankan skrip pengaktifan, jalankan `Set-ExecutionPolicy -Scope Process RemoteSigned` dahulu. Ia hanya terpakai pada tetingkap itu.
|
||||||
|
|
||||||
|
### Linux Debian
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install git python3 python3-venv
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install python@3.13 git
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
python3.13 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Semak ia berfungsi
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m nato_phonetic_alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
Masukkan satu perkataan. Anda akan melihat kata kodnya. Seterusnya: [Penggunaan](Usage-ms).
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
# Install
|
||||||
|
|
||||||
|
🌐 **English** · [Dansk](Install-da) · [Bahasa Melayu](Install-ms)
|
||||||
|
|
||||||
|
## What you need
|
||||||
|
|
||||||
|
- Python 3.13 or newer with the `venv` module
|
||||||
|
- Git
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
|
||||||
|
Every system does the same four things: clone the repository, create a virtual environment called `.venv`, upgrade pip, install the project.
|
||||||
|
|
||||||
|
### Windows PowerShell
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
py -3.13 -m venv .venv
|
||||||
|
.\.venv\Scripts\Activate.ps1
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
If PowerShell refuses to run the activation script, run `Set-ExecutionPolicy -Scope Process RemoteSigned` first. It only applies to that window.
|
||||||
|
|
||||||
|
### Linux Debian
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install git python3 python3-venv
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install python@3.13 git
|
||||||
|
git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet.git
|
||||||
|
cd 030-nato-phonetic-alphabet
|
||||||
|
python3.13 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
python -m pip install -e ".[dev]"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Check that it works
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m nato_phonetic_alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
Enter a word. You should see its code words. Next: [Usage](Usage).
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Brug
|
||||||
|
|
||||||
|
🌐 [English](Usage) · **Dansk** · [Bahasa Melayu](Usage-ms)
|
||||||
|
|
||||||
|
Aktivér det virtuelle miljø (se [Installation](Install-da)), og start programmet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m nato_phonetic_alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
Den installerede kommando gør det samme:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nato-phonetic-alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
## Stav et ord
|
||||||
|
|
||||||
|
Programmet spørger efter et ord og skriver NATO-kodeordet for hvert bogstav i rækkefølge. Store og små bogstaver giver samme resultat.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Ugyldigt input
|
||||||
|
|
||||||
|
Et ciffer, et mellemrum eller et tegn er ikke et bogstav. Programmet siger det og spørger igen.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Tryk Ctrl+C eller Ctrl+D
|
||||||
|
|
||||||
|
Afslutter du inputtet (Ctrl+D på Linux og macOS, Ctrl+Z og Enter på Windows) eller trykker Ctrl+C, lukker programmet stille.
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Penggunaan
|
||||||
|
|
||||||
|
🌐 [English](Usage) · [Dansk](Usage-da) · **Bahasa Melayu**
|
||||||
|
|
||||||
|
Aktifkan persekitaran maya (lihat [Pemasangan](Install-ms)), kemudian mulakan program:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m nato_phonetic_alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
Arahan yang dipasang melakukan perkara yang sama:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nato-phonetic-alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
## Eja satu perkataan
|
||||||
|
|
||||||
|
Program meminta satu perkataan dan mencetak kata kod NATO bagi setiap huruf mengikut urutan. Huruf besar dan huruf kecil memberi keputusan yang sama.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Input tidak sah
|
||||||
|
|
||||||
|
Angka, ruang atau tanda baca bukan huruf. Program memberitahu perkara itu dan bertanya semula.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Tekan Ctrl+C atau Ctrl+D
|
||||||
|
|
||||||
|
Menamatkan input (Ctrl+D di Linux dan macOS, Ctrl+Z kemudian Enter di Windows) atau menekan Ctrl+C menutup program dengan senyap.
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Usage
|
||||||
|
|
||||||
|
🌐 **English** · [Dansk](Usage-da) · [Bahasa Melayu](Usage-ms)
|
||||||
|
|
||||||
|
Activate the virtual environment (see [Install](Install)), then start the program:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m nato_phonetic_alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
The installed command does the same:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nato-phonetic-alphabet
|
||||||
|
```
|
||||||
|
|
||||||
|
## Spell a word
|
||||||
|
|
||||||
|
The program asks for a word and prints the NATO code word of each letter, in order. Upper and lower case give the same result.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Invalid input
|
||||||
|
|
||||||
|
A digit, a space or a punctuation mark is not a letter. The program says so and asks again.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Press Ctrl+C or Ctrl+D
|
||||||
|
|
||||||
|
Ending the input (Ctrl+D on Linux and macOS, Ctrl+Z then Enter on Windows) or pressing Ctrl+C closes the program quietly.
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
**NATO phonetic alphabet**
|
||||||
|
|
||||||
|
- [Home](Home)
|
||||||
|
- [Install](Install)
|
||||||
|
- [Usage](Usage)
|
||||||
|
- [Development](Development)
|
||||||
|
|
||||||
|
**Dansk**
|
||||||
|
|
||||||
|
- [Hjem](Home-da)
|
||||||
|
- [Installation](Install-da)
|
||||||
|
- [Brug](Usage-da)
|
||||||
|
- [Udvikling](Development-da)
|
||||||
|
|
||||||
|
**Bahasa Melayu**
|
||||||
|
|
||||||
|
- [Utama](Home-ms)
|
||||||
|
- [Pemasangan](Install-ms)
|
||||||
|
- [Penggunaan](Usage-ms)
|
||||||
|
- [Pembangunan](Development-ms)
|
||||||
|
|
||||||
|
**Links**
|
||||||
|
|
||||||
|
- [Repository](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/030-nato-phonetic-alphabet)
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
"""@brief Entry point of the command `python -m nato_phonetic_alphabet`."""
|
||||||
|
|
||||||
|
from nato_phonetic_alphabet.main import main
|
||||||
|
|
||||||
|
raise SystemExit(main())
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""@brief Adapters of the NATO alphabet tool: data file and console."""
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
"""@brief Adapter that talks to the user through the terminal."""
|
||||||
|
|
||||||
|
from nato_phonetic_alphabet import constants
|
||||||
|
from nato_phonetic_alphabet.application.ports import InputClosedError
|
||||||
|
|
||||||
|
|
||||||
|
class TerminalConsole:
|
||||||
|
"""@brief WordConsole port implemented on standard input and output."""
|
||||||
|
|
||||||
|
def ask_word(self) -> str:
|
||||||
|
"""@brief Prompt for a word.
|
||||||
|
|
||||||
|
@return The word as typed.
|
||||||
|
@throws InputClosedError Input ended or the user interrupted it.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
return input(constants.PROMPT_TEXT)
|
||||||
|
except (EOFError, KeyboardInterrupt) as error:
|
||||||
|
raise InputClosedError from error
|
||||||
|
|
||||||
|
def show_invalid(self) -> None:
|
||||||
|
"""@brief Print that the word was rejected."""
|
||||||
|
print(constants.INVALID_INPUT_TEXT)
|
||||||
|
|
||||||
|
def show_code_words(self, code_words: list[str]) -> None:
|
||||||
|
"""@brief Print the result.
|
||||||
|
|
||||||
|
@param code_words The code words to print.
|
||||||
|
"""
|
||||||
|
print(constants.RESULT_TEXT)
|
||||||
|
print(*code_words, sep="\n")
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
"""@brief Adapter that reads the NATO alphabet from a CSV file."""
|
||||||
|
|
||||||
|
import csv
|
||||||
|
from importlib import resources
|
||||||
|
from importlib.resources.abc import Traversable
|
||||||
|
|
||||||
|
from nato_phonetic_alphabet import constants
|
||||||
|
|
||||||
|
|
||||||
|
def packaged_data_file() -> Traversable:
|
||||||
|
"""@brief Locate the data file shipped with the package.
|
||||||
|
|
||||||
|
@return The packaged CSV file.
|
||||||
|
"""
|
||||||
|
return (
|
||||||
|
resources.files(constants.DATA_PACKAGE)
|
||||||
|
/ constants.DATA_DIRECTORY
|
||||||
|
/ constants.DATA_FILE_NAME
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def load_nato_dict(path: Traversable | None = None) -> dict[str, str]:
|
||||||
|
"""@brief Read the NATO alphabet from a CSV file.
|
||||||
|
|
||||||
|
@param path The CSV file; the packaged file when omitted.
|
||||||
|
@return Code word per upper-case letter.
|
||||||
|
"""
|
||||||
|
source = path if path is not None else packaged_data_file()
|
||||||
|
with source.open("r", encoding=constants.DATA_ENCODING) as stream:
|
||||||
|
return {
|
||||||
|
row[constants.LETTER_COLUMN].upper(): row[constants.CODE_COLUMN]
|
||||||
|
for row in csv.DictReader(stream)
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""@brief Use case and ports of the NATO alphabet tool."""
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
"""@brief Use case: ask for a word until it can be spelled."""
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
|
||||||
|
from nato_phonetic_alphabet.application.ports import WordConsole
|
||||||
|
from nato_phonetic_alphabet.domain.spelling import InvalidWordError, spell_word
|
||||||
|
|
||||||
|
|
||||||
|
def generate_phonetic(alphabet: Mapping[str, str], console: WordConsole) -> list[str]:
|
||||||
|
"""@brief Ask for a word until it is valid, then return its code words.
|
||||||
|
|
||||||
|
This is the assignment's `generate_phonetic`: it wraps the input and the
|
||||||
|
error handling. An invalid word is reported to the user and asked for
|
||||||
|
again, so the function returns only for a valid word.
|
||||||
|
|
||||||
|
@param alphabet Code word per upper-case letter.
|
||||||
|
@param console Conversation with the user.
|
||||||
|
@return The code words of the word the user typed.
|
||||||
|
@throws InputClosedError The user can give no more input.
|
||||||
|
"""
|
||||||
|
while True:
|
||||||
|
word = console.ask_word()
|
||||||
|
try:
|
||||||
|
return spell_word(word, alphabet)
|
||||||
|
except InvalidWordError:
|
||||||
|
console.show_invalid()
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
"""@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.
|
||||||
|
"""
|
||||||
|
...
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
"""@brief Business rules of the NATO alphabet tool, free of input and output."""
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
"""@brief Rule that spells a word with the NATO phonetic alphabet."""
|
||||||
|
|
||||||
|
from collections.abc import Mapping
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidWordError(ValueError):
|
||||||
|
"""@brief Raised when a word cannot be spelled.
|
||||||
|
|
||||||
|
A word is invalid when it is empty or holds a character that is not a
|
||||||
|
letter A to Z.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def spell_word(word: str, alphabet: Mapping[str, str]) -> list[str]:
|
||||||
|
"""@brief Spell a word with the code word of each of its letters.
|
||||||
|
|
||||||
|
The list comprehension looks every letter up in the alphabet. A character
|
||||||
|
that is not in the alphabet makes the lookup fail with a `KeyError`, which
|
||||||
|
is caught here and turned into an `InvalidWordError`. The match is
|
||||||
|
case-insensitive.
|
||||||
|
|
||||||
|
@param word The word to spell.
|
||||||
|
@param alphabet Code word per upper-case letter.
|
||||||
|
@return The code words, one per letter of the word, in order.
|
||||||
|
@throws InvalidWordError The word is empty or holds a character that is
|
||||||
|
not a letter of the alphabet.
|
||||||
|
"""
|
||||||
|
if not word:
|
||||||
|
raise InvalidWordError("The word is empty.")
|
||||||
|
try:
|
||||||
|
return [alphabet[letter.upper()] for letter in word]
|
||||||
|
except KeyError as error:
|
||||||
|
raise InvalidWordError(f"Not a letter: {error.args[0]!r}") from error
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
"""@brief Composition root: wires the adapters into the use case."""
|
||||||
|
|
||||||
|
from nato_phonetic_alphabet import constants
|
||||||
|
from nato_phonetic_alphabet.adapters.console import TerminalConsole
|
||||||
|
from nato_phonetic_alphabet.adapters.csv_alphabet import load_nato_dict
|
||||||
|
from nato_phonetic_alphabet.application.phonetic import generate_phonetic
|
||||||
|
from nato_phonetic_alphabet.application.ports import InputClosedError
|
||||||
|
from nato_phonetic_alphabet.domain.spelling import InvalidWordError, spell_word
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"InvalidWordError",
|
||||||
|
"generate_phonetic",
|
||||||
|
"load_nato_dict",
|
||||||
|
"main",
|
||||||
|
"spell_word",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
"""@brief Run the interactive tool.
|
||||||
|
|
||||||
|
Ends without a result when the user can give no more input.
|
||||||
|
|
||||||
|
@return The exit status of the program.
|
||||||
|
"""
|
||||||
|
console = TerminalConsole()
|
||||||
|
try:
|
||||||
|
code_words = generate_phonetic(load_nato_dict(), console)
|
||||||
|
except InputClosedError:
|
||||||
|
return constants.EXIT_OK
|
||||||
|
console.show_code_words(code_words)
|
||||||
|
return constants.EXIT_OK
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from nato_phonetic_alphabet import constants
|
||||||
|
from nato_phonetic_alphabet.adapters.console import TerminalConsole
|
||||||
|
from nato_phonetic_alphabet.application.ports import InputClosedError
|
||||||
|
from nato_phonetic_alphabet.main import main
|
||||||
|
|
||||||
|
|
||||||
|
def _feed(monkeypatch: pytest.MonkeyPatch, answers: list[str]) -> list[str]:
|
||||||
|
prompts: list[str] = []
|
||||||
|
|
||||||
|
def fake_input(prompt: str = "") -> str:
|
||||||
|
prompts.append(prompt)
|
||||||
|
if not answers:
|
||||||
|
raise EOFError
|
||||||
|
return answers.pop(0)
|
||||||
|
|
||||||
|
monkeypatch.setattr("builtins.input", fake_input)
|
||||||
|
return prompts
|
||||||
|
|
||||||
|
|
||||||
|
def test_main_prints_code_words_for_valid_word(
|
||||||
|
monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
|
||||||
|
) -> None:
|
||||||
|
_feed(monkeypatch, ["Hello"])
|
||||||
|
|
||||||
|
status = main()
|
||||||
|
|
||||||
|
lines = capsys.readouterr().out.splitlines()
|
||||||
|
assert status == constants.EXIT_OK
|
||||||
|
assert lines == [constants.RESULT_TEXT, "Hotel", "Echo", "Lima", "Lima", "Oscar"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_main_asks_again_after_invalid_word(
|
||||||
|
monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
|
||||||
|
) -> None:
|
||||||
|
prompts = _feed(monkeypatch, ["h3llo", "Hi"])
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
|
lines = capsys.readouterr().out.splitlines()
|
||||||
|
assert prompts == [constants.PROMPT_TEXT, constants.PROMPT_TEXT]
|
||||||
|
assert lines == [
|
||||||
|
constants.INVALID_INPUT_TEXT,
|
||||||
|
constants.RESULT_TEXT,
|
||||||
|
"Hotel",
|
||||||
|
"India",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def test_main_ends_cleanly_on_end_of_input(
|
||||||
|
monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
|
||||||
|
) -> None:
|
||||||
|
_feed(monkeypatch, [])
|
||||||
|
|
||||||
|
status = main()
|
||||||
|
|
||||||
|
assert status == constants.EXIT_OK
|
||||||
|
assert capsys.readouterr().out == ""
|
||||||
|
|
||||||
|
|
||||||
|
def test_terminal_console_raises_input_closed_on_interrupt(
|
||||||
|
monkeypatch: pytest.MonkeyPatch,
|
||||||
|
) -> None:
|
||||||
|
def interrupted(prompt: str = "") -> str:
|
||||||
|
raise KeyboardInterrupt
|
||||||
|
|
||||||
|
monkeypatch.setattr("builtins.input", interrupted)
|
||||||
|
|
||||||
|
with pytest.raises(InputClosedError):
|
||||||
|
TerminalConsole().ask_word()
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
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"
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from nato_phonetic_alphabet.application.phonetic import generate_phonetic
|
||||||
|
from nato_phonetic_alphabet.application.ports import InputClosedError
|
||||||
|
|
||||||
|
ALPHABET = {"A": "Alfa", "B": "Bravo"}
|
||||||
|
|
||||||
|
|
||||||
|
class FakeConsole:
|
||||||
|
def __init__(self, words: list[str]) -> None:
|
||||||
|
self._words = words
|
||||||
|
self.asked = 0
|
||||||
|
self.invalid = 0
|
||||||
|
|
||||||
|
def ask_word(self) -> str:
|
||||||
|
self.asked += 1
|
||||||
|
if not self._words:
|
||||||
|
raise InputClosedError
|
||||||
|
return self._words.pop(0)
|
||||||
|
|
||||||
|
def show_invalid(self) -> None:
|
||||||
|
self.invalid += 1
|
||||||
|
|
||||||
|
def show_code_words(self, code_words: list[str]) -> None:
|
||||||
|
raise AssertionError("generate_phonetic must not print the result")
|
||||||
|
|
||||||
|
|
||||||
|
def test_generate_phonetic_returns_code_words_for_valid_word() -> None:
|
||||||
|
console = FakeConsole(["ab"])
|
||||||
|
|
||||||
|
assert generate_phonetic(ALPHABET, console) == ["Alfa", "Bravo"]
|
||||||
|
assert console.asked == 1
|
||||||
|
assert console.invalid == 0
|
||||||
|
|
||||||
|
|
||||||
|
def test_generate_phonetic_asks_again_after_invalid_words() -> None:
|
||||||
|
console = FakeConsole(["a1", "", "b"])
|
||||||
|
|
||||||
|
assert generate_phonetic(ALPHABET, console) == ["Bravo"]
|
||||||
|
assert console.invalid == 2
|
||||||
|
assert console.asked == 3
|
||||||
|
|
||||||
|
|
||||||
|
def test_generate_phonetic_lets_closed_input_escape() -> None:
|
||||||
|
console = FakeConsole(["x"])
|
||||||
|
|
||||||
|
with pytest.raises(InputClosedError):
|
||||||
|
generate_phonetic(ALPHABET, console)
|
||||||
|
assert console.invalid == 1
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from nato_phonetic_alphabet.adapters.csv_alphabet import load_nato_dict
|
||||||
|
from nato_phonetic_alphabet.domain.spelling import InvalidWordError, spell_word
|
||||||
|
|
||||||
|
ALPHABET = load_nato_dict()
|
||||||
|
LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("letter", list(LETTERS))
|
||||||
|
def test_spell_word_maps_letter_to_its_code_word(letter: str) -> None:
|
||||||
|
assert spell_word(letter, ALPHABET) == [ALPHABET[letter]]
|
||||||
|
|
||||||
|
|
||||||
|
def test_spell_word_uses_known_code_words() -> None:
|
||||||
|
assert spell_word("ADZ", ALPHABET) == ["Alfa", "Delta", "Zulu"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_spell_word_covers_all_26_letters() -> None:
|
||||||
|
assert len(spell_word(LETTERS, ALPHABET)) == len(LETTERS)
|
||||||
|
|
||||||
|
|
||||||
|
def test_spell_word_is_case_insensitive_for_mixed_case() -> None:
|
||||||
|
assert spell_word("Hello", ALPHABET) == [
|
||||||
|
"Hotel",
|
||||||
|
"Echo",
|
||||||
|
"Lima",
|
||||||
|
"Lima",
|
||||||
|
"Oscar",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("word", ["a1", "two words", "hi!", "", "ß", "æ"])
|
||||||
|
def test_spell_word_raises_for_non_letter_or_empty(word: str) -> None:
|
||||||
|
with pytest.raises(InvalidWordError):
|
||||||
|
spell_word(word, ALPHABET)
|
||||||
|
|
||||||
|
|
||||||
|
def test_spell_word_keeps_cause_of_invalid_character() -> None:
|
||||||
|
with pytest.raises(InvalidWordError) as info:
|
||||||
|
spell_word("a1", ALPHABET)
|
||||||
|
|
||||||
|
assert isinstance(info.value.__cause__, KeyError)
|
||||||
@@ -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