Exemplo n.º 1
0
    def test_product(self):
        """
        tests thte basic functionality of the Product class
        """
        p1 = Product("889", "Rodent of unusual size",
                     "when a rodent of the usual size just won't do", 33.45, 8)
        self.assertEqual(p1.get_product_id(), "889")
        self.assertEqual(p1.get_title(), "Rodent of unusual size")
        self.assertEqual(p1.get_description(),
                         "when a rodent of the usual size just won't do")
        self.assertEqual(p1.get_price(), 33.45)
        self.assertEqual(p1.get_quantity_available(), 8)

        p1.decrease_quantity()

        self.assertEqual(p1.get_quantity_available(), 7)
Exemplo n.º 2
0
    def test_4(self):
        fourth_product = Product(200, "Pencil", "Number 2 Pencil", 0.99, 1)
        product_price = fourth_product.get_price()

        self.assertEqual(product_price, 0.99)