Пример #1
0
    def test_validate_input_2(self):
        cart_items = list([
            CartItem(Item(True, True), 10.00),
            CartItem(Item(False, True), 47.50),
        ])
        shopping_cart = ShoppingCart(cart_items)

        assert shopping_cart.calculate_sales_tax() == "7.65"
        assert shopping_cart.calculate_total() == "65.15"
Пример #2
0
    def test_validate_input_1(self):
        cart_items = list([
            CartItem(Item(True, False), 12.49),
            CartItem(Item(False, False), 14.99),
            CartItem(Item(True, False), 0.85),
        ])
        shopping_cart = ShoppingCart(cart_items)

        assert shopping_cart.calculate_sales_tax() == "1.50"
        assert shopping_cart.calculate_total() == "29.83"
Пример #3
0
    def test_validate_input_3(self):
        cart_items = list([
            CartItem(Item(False, True), 27.99),
            CartItem(Item(False, False), 18.99),
            CartItem(Item(True, False), 9.75),
            CartItem(Item(True, True), 11.25)
        ])
        shopping_cart = ShoppingCart(cart_items)

        assert shopping_cart.calculate_sales_tax() == "6.70"
        assert shopping_cart.calculate_total() == "74.68"