def test_canMakeDrink_recipe_unkown(): """ Test to see if canMakeDrink 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) with pytest.raises(ValueError, match="Drink recipe is not known" + " in canMake."): CM._CoffeeMachine__canMakeDrink("hot_tea")
def test_canMakeDrink_drink_type(): """ Test to see if canMakeDrink 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" + " in canMake."): CM._CoffeeMachine__canMakeDrink(1)
def test_canMakeDrink_functionality_possible(): """ Test to see if canMake 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) assert CM._CoffeeMachine__canMakeDrink("hot_tea") == 1
def test_canMakeDrink_functionality_impossible(): """ Test to see if canMake works if drink is not possible to make because of non-existent ingredient. """ # assign data to pass to coffee machine num_outlets = 1 beverages = {"hot_tea": {"cocoa": 2}} total_items_qty = {"milk": 1} CM = CoffeeMachine(num_outlets, beverages, total_items_qty) assert CM._CoffeeMachine__canMakeDrink("hot_tea") == -1