def test_addTopping(): cp2 = CustomPizza("M") assert cp2.price == 10.00 cp2.addTopping("extra cheese") cp2.addTopping("pineapple") cp2.addTopping("sausage") assert cp2.price == 12.25
def getOrderDescription(self): details = "******\nOrder Time: {}\n".format(self.getTime()) for pizza in self.pizzas: if type(pizza) == CustomPizza: details = details + "{}\n----\n".format(CustomPizza.getPizzaDetails(pizza)) elif type(pizza) == SpecialtyPizza: details = details + "{}\n----\n".format(SpecialtyPizza.getPizzaDetails(pizza)) details = details + "TOTAL ORDER PRICE: ${:.2f}\n******\n".format(self.getTotal()) return details
def test_addPizza(): cp1 = CustomPizza("S") cp1.addTopping("extra cheese") cp1.addTopping("sausage") sp1 = SpecialtyPizza("S", "Carne-more") order = PizzaOrder(123000) #12:30:00PM order.addPizza(cp1) order.addPizza(sp1) assert order.getOrderDescription() == \ "******\n\
def test_OrderQueue(): queue = OrderQueue() cp1 = CustomPizza("L") cp1.addTopping("extra cheese") cp1.addTopping("sausage") sp1 = SpecialtyPizza("M", "Carne-more") sp2 = SpecialtyPizza("S", "Veggie-Lover") order = PizzaOrder(123030) order.addPizza(cp1) order.addPizza(sp1) order.addPizza(sp2) queue.addOrder(order) assert queue.processNextOrder() == \ "******\n\ Order Time: 123030\n\ CUSTOM PIZZA\n\ Size: L\n\ Toppings:\n\ \t+ extra cheese\n\ \t+ sausage\n\ Price: $14.00\n\ \n\ ----\n\ SPECIALTY PIZZA\n\ Size: M\n\ Name: Carne-more\n\ Price: $14.00\n\ \n\ ----\n\ SPECIALTY PIZZA\n\ Size: S\n\ Name: Veggie-Lover\n\ Price: $12.00\n\ \n\ ----\n\ TOTAL ORDER PRICE: $40.00\n\ ******\n" with pytest.raises(QueueEmptyException): assert queue.processNextOrder()
def getOrderDescription(self): details = "******\nOrder Time: {}\n".format(self.getTime()) for pizza in self.pizzas: if type(pizza) == CustomPizza: details = details + "{}\n----\n".format(CustomPizza.getPizzaDetails(pizza)) elif type(pizza) == SpecialtyPizza: details = details + "{}\n----\n".format(SpecialtyPizza.getPizzaDetails(pizza)) details = details + "TOTAL ORDER PRICE: ${:.2f}\n******\n".format(self.getTotal()) return details def __repr__(self): return self.getOrderDescription() cp1 = CustomPizza("S") cp1.addTopping("extra cheese") cp1.addTopping("sausage") sp1 = SpecialtyPizza("S", "Carne-more") order = PizzaOrder(123000) #12:30:00PM order.addPizza(cp1) order.addPizza(sp1) # print (order.getOrderDescription()) assert order.getOrderDescription() == \ "******\n\ Order Time: 123000\n\ CUSTOM PIZZA\n\ Size: S\n\ Toppings:\n\
def test_getPizzaDetails(): cp2 = CustomPizza("M") cp2.addTopping("extra cheese") cp2.addTopping("pineapple") cp2.addTopping("sausage") assert cp2.getPizzaDetails() == "CUSTOM PIZZA\n\
def test__init__2(): cp2 = CustomPizza("M") assert cp2.size == "M" assert cp2.price == 10.00
def test___init__(): cp1 = CustomPizza("S") assert cp1.size == "S"