コード例 #1
0
    def test_itShouldFailBySayingCannotRemoveFromCart_whenWeTryToRemoveNonExistantItem(
            self):
        cart = Cart()

        cart.add_item('iPhone')

        with self.assertRaises(CannotRemoveFromCart):
            cart.remove_item('Air Buds')
コード例 #2
0
    def test_theNumberOfItemsShouldBeEmpty_whenWeAddAnItemAndThenRemoveIt(
            self):
        cart = Cart()
        cart.add_item('iPhone')

        cart.remove_item('iPhone')

        self.assertTrue(cart.is_empty())
コード例 #3
0
    def test_theItemShouldNotExist_whenItsQuantityIsZero(self):
        cart = Cart()
        cart.add_item('iPhone')
        cart.remove_item('iPhone')

        self.assertEqual(False, cart.exists('iPhone'))
コード例 #4
0
    def test_itShouldFailBySayingCannotRemoveFromCart_whenWeRemoveItemFromEmptyCart(
            self):
        cart = Cart()

        with self.assertRaises(CannotRemoveFromCart):
            cart.remove_item('iPhone')