def test_pizza_calculate_total_weight(self): d = Dough("Sugar", "Mixing", 20) t = Topping("Tomato", 20) p = Pizza("Burger", d, 200) p.add_topping(t) p.add_topping(t) self.assertEqual(p.calculate_total_weight(), 60)
def test_pizza_add_topping_error(self): d = Dough("Sugar", "Mixing", 20) t = Topping("Tomato", 20) p = Pizza("Burger", d, 0) with self.assertRaises(ValueError) as ctx: p.add_topping(t) self.assertEqual("Not enough space for another topping", str(ctx.exception))
def test_pizza_add_topping_update(self): d = Dough("Sugar", "Mixing", 20) t = Topping("Tomato", 20) p = Pizza("Burger", d, 200) p.add_topping(t) p.add_topping(t) self.assertEqual(p.toppings["Tomato"], 40)
def test_pizza_init(self): d = Dough("Sugar", "Mixing", 20) p = Pizza("Burger", d, 5) self.assertEqual(p._Pizza__name, "Burger") self.assertEqual(p._Pizza__dough, d) self.assertEqual(len(p._Pizza__toppings), 0) self.assertEqual(p._Pizza__toppings_capacity, 5)
print(mushrooms_topping.topping_type) print(mushrooms_topping.weight) mozzarella_topping = Topping("Mozzarella", 80) print(mozzarella_topping.topping_type) print(mozzarella_topping.weight) cheddar_topping = Topping("Cheddar", 150) pepperoni_topping = Topping("Pepperoni", 120) white_flour_dough = Dough("White Flour", "Mixing", 200) print(white_flour_dough.flour_type) print(white_flour_dough.weight) print(white_flour_dough.baking_technique) whole_wheat_dough = Dough("Whole Wheat Flour", "Mixing", 200) print(whole_wheat_dough.weight) print(whole_wheat_dough.flour_type) print(whole_wheat_dough.baking_technique) p = Pizza("Margherita", whole_wheat_dough, 2) p.add_topping(tomato_topping) print(p.calculate_total_weight()) p.add_topping(mozzarella_topping) print(p.calculate_total_weight()) p.add_topping(mozzarella_topping)