示例#1
0
    def test_take_adds_new_orders(self):
        message = "Taking order from John for 10.50"
        input = ["take", "John", "10.5"]

        self.assertEqual(message, pizza.take(self.orders, input))
        self.assertEqual(3, len(self.orders))
        self.assertEqual(1, len(self.orders["John"]))
        self.assertEqual(10.5, self.orders["John"][0])
示例#2
0
    def test_take_adds_orders_to_existing_person(self):
        message = "Taking order from Emi for 2.00"
        input = ["take", "Emi", "2"]

        self.assertEqual(message, pizza.take(self.orders, input))
        self.assertEqual(2, len(self.orders))
        self.assertEqual(2, len(self.orders["Emi"]))
        self.assertEqual(2.00, self.orders["Emi"][1])
        self.assertEqual(12.00, sum(self.orders["Emi"]))
示例#3
0
    def test_take_expects_two_parameters(self):
        error_message = "Invalid command! Try take <name> <price>"

        self.assertEqual(error_message, pizza.take(self.orders, ["take"]))
        self.assertEqual(error_message, pizza.take(self.orders, []))