MIL-003: Add console interface #32

Merged
Tirsvad merged 1 commits from mil-003-console-interface into main 2026-10-04 15:01:15 +02:00
Owner

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

## 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
Tirsvad added 1 commit 2026-10-04 15:00:42 +02:00
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 #22
Closes #23
Closes #24
Closes #25

Task: MIL-003#1
Task: MIL-003#2
Task: MIL-003#3
Task: MIL-003#4
Tirsvad merged commit 142a027e5c into main 2026-10-04 15:01:15 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Tirsvad-Udemy-100_days_of_code/010-calc#32