calculator() in src/calc/calculator.py looks the operation up in OPERATIONS; y continues with the result, n starts a new calculation by calling calculator() again (recursion), q quits
One ASCII title at start: a calculator with the lettering to its right (ASCII_TITLE in constants.py)
Invalid numbers, operations and answers are re-prompted; division by zero prints a message and restarts
src/calc/__main__.py for python -m calc, and the calc console script in pyproject.toml
tests/test_calculator.py feeds input() through monkeypatch
Checks
pytest: 13 passed
doxygen Doxyfile builds without warnings
Manual run of python -m calc and calc: division by zero, continue with result, quit
## Summary
MIL-003 Console interface:
- `calculator()` in `src/calc/calculator.py` looks the operation up in `OPERATIONS`; `y` continues with the result, `n` starts a new calculation by calling `calculator()` again (recursion), `q` quits
- One ASCII title at start: a calculator with the lettering to its right (`ASCII_TITLE` in `constants.py`)
- Invalid numbers, operations and answers are re-prompted; division by zero prints a message and restarts
- `src/calc/__main__.py` for `python -m calc`, and the `calc` console script in `pyproject.toml`
- `tests/test_calculator.py` feeds `input()` through monkeypatch
## Checks
- pytest: 13 passed
- `doxygen Doxyfile` builds without warnings
- Manual run of `python -m calc` and `calc`: division by zero, continue with result, quit
Closes #22
Closes #23
Closes #24
Closes #25
MIL-003 Console interface.
- Add calculator() with recursive restart: y continues with the result,
n starts a new calculation, q quits
- Show one ASCII title at start: a calculator with the lettering to
its right
- Re-prompt on invalid numbers, operations and answers; restart on
division by zero
- Add __main__.py for python -m calc and the calc console script
- Add interface tests with input() fed through monkeypatch
Closes#22Closes#23Closes#24Closes#25
Task: MIL-003#1
Task: MIL-003#2
Task: MIL-003#3
Task: MIL-003#4
Tirsvad
merged commit 142a027e5c into main2026-10-04 15:01:15 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
MIL-003 Console interface:
calculator()insrc/calc/calculator.pylooks the operation up inOPERATIONS;ycontinues with the result,nstarts a new calculation by callingcalculator()again (recursion),qquitsASCII_TITLEinconstants.py)src/calc/__main__.pyforpython -m calc, and thecalcconsole script inpyproject.tomltests/test_calculator.pyfeedsinput()through monkeypatchChecks
doxygen Doxyfilebuilds without warningspython -m calcandcalc: division by zero, continue with result, quitCloses #22
Closes #23
Closes #24
Closes #25