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
25 lines
760 B
Python
25 lines
760 B
Python
"""! @file
|
|
@brief Checks that the constants are consistent with each other.
|
|
"""
|
|
|
|
from coffee_machine import constants
|
|
|
|
|
|
def test_every_drink_has_a_cost_and_ingredients() -> None:
|
|
assert set(constants.DRINK_COSTS) == set(constants.DRINK_INGREDIENTS)
|
|
|
|
|
|
def test_every_drink_uses_known_ingredients() -> None:
|
|
known = set(constants.INITIAL_RESOURCES)
|
|
for ingredients in constants.DRINK_INGREDIENTS.values():
|
|
assert set(ingredients) <= known
|
|
|
|
|
|
def test_every_resource_has_a_unit() -> None:
|
|
assert set(constants.INITIAL_RESOURCES) == set(constants.RESOURCE_UNITS)
|
|
|
|
|
|
def test_commands_are_not_drink_names() -> None:
|
|
assert constants.COMMAND_OFF not in constants.DRINK_COSTS
|
|
assert constants.COMMAND_REPORT not in constants.DRINK_COSTS
|