def test_makeDrink_drink_type(): """ Test to see if makeDrink works when drink name is not a string. """ # assign data to pass to coffee machine num_outlets = 1 beverages = {} total_items_qty = {} CM = CoffeeMachine(num_outlets, beverages, total_items_qty) with pytest.raises(ValueError, match="Drink name is not a string."): CM._CoffeeMachine__makeDrink(1, 1)
def test_makeDrink_functionality_possible(): """ Test to see if makeDrink works if drink is possible to make. """ # assign data to pass to coffee machine num_outlets = 1 beverages = {"hot_tea": {"milk": 1}} total_items_qty = {"milk": 2} CM = CoffeeMachine(num_outlets, beverages, total_items_qty) CM.running_threads = [1] CM._CoffeeMachine__makeDrink("hot_tea", 1) assert CM.raw_material_qty["milk"] == 1
def test_makeDrink_recipe_unkown(): """ Test to see if makeDrink works when drink recipe is not known. """ # assign data to pass to coffee machine num_outlets = 1 beverages = {} total_items_qty = {} CM = CoffeeMachine(num_outlets, beverages, total_items_qty) CM.running_threads = [1] with pytest.raises(ValueError, match="Drink recipe is not known."): CM._CoffeeMachine__makeDrink("hot_tea", 1)