CI / test (push) Successful in 50s
Add the Menu, MenuItem, CoffeeMaker and MoneyMachine classes with the assignment's method names, and a main loop that supports drink names, report and off. Resources are checked before payment, and payment before the drink is made. Move drink prices, ingredient amounts and all message text into constants.py. Add 25 pytest tests for every class and the main loop, and record the review against QC-PY-001 as RC-007. Task: MIL-002#1 Task: MIL-002#2 Task: MIL-002#3 Task: MIL-002#4 Task: MIL-002#5 Task: MIL-002#6 Closes #6 Closes #7 Closes #8 Closes #9 Closes #10 Closes #11
21 lines
489 B
Python
21 lines
489 B
Python
"""! @file
|
|
@brief Shared test helpers.
|
|
"""
|
|
|
|
from collections.abc import Callable, Iterable
|
|
|
|
import pytest
|
|
|
|
InputFeeder = Callable[[Iterable[str]], None]
|
|
|
|
|
|
@pytest.fixture
|
|
def feed_input(monkeypatch: pytest.MonkeyPatch) -> InputFeeder:
|
|
"""! @brief Return a function that makes input() answer from a list."""
|
|
|
|
def feed(answers: Iterable[str]) -> None:
|
|
iterator = iter(answers)
|
|
monkeypatch.setattr("builtins.input", lambda _prompt="": next(iterator))
|
|
|
|
return feed
|