Exemple #1
0
    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)
Exemple #2
0
    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)
Exemple #3
0
 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))
Exemple #4
0
from project.dough import Dough
from project.pizza import Pizza
from project.topping import Topping

tomato_topping = Topping("Tomato", 60)
print(tomato_topping.topping_type)
print(tomato_topping.weight)

mushrooms_topping = Topping("Mushroom", 75)
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)
Exemple #5
0
 def test_topping_init(self):
     t = Topping("Tomato", 20)
     self.assertEqual(t._Topping__topping_type, "Tomato")
     self.assertEqual(t._Topping__weight, 20)
Exemple #6
0
 def test_topping_weight_error(self):
     with self.assertRaises(ValueError) as ve:
         t = Topping("a", -1)
     self.assertEqual("The weight cannot be less or equal to zero",
                      str(ve.exception))
Exemple #7
0
 def test_topping_topping_type_error(self):
     with self.assertRaises(ValueError) as ve:
         t = Topping("", 20)
     self.assertEqual("The topping type cannot be an empty string",
                      str(ve.exception))