コード例 #1
0
 def test_init(self):
     my_laptop = Laptop("Lenovo", 1000, 1200, 500, 4)
     self.assertEqual("Lenovo", my_laptop.name)
     self.assertEqual(1000, my_laptop.stock_price)
     self.assertEqual(1200, my_laptop.final_price)
     self.assertEqual(500, my_laptop.diskspace)
     self.assertEqual(4, my_laptop.RAM)
コード例 #2
0
 def test_total_income(self):
     my_store = Store("Ardes")
     new_laptop = Laptop('HP HackBook', 1000, 1243, 1000, 4)
     my_store.load_new_products(new_laptop, 20)
     my_store.sell_product(new_laptop)
     self.assertEqual(243, my_store.total_income())
コード例 #3
0
 def test_sell_product_false(self):
     my_store = Store("Ardes")
     new_laptop = Laptop('HP HackBook', 1000, 1243, 1000, 4)
     my_store.load_new_products(new_laptop, 0)
     self.assertFalse(my_store.sell_product(new_laptop))
コード例 #4
0
 def test_list_product(self):
     my_store = Store("Ardes")
     new_laptop = Laptop('HP HackBook', 1000, 1243, 1000, 4)
     my_store.load_new_products(new_laptop, 20)
     self.assertEqual("HP HackBook - 20", my_store.list_products(Laptop))
コード例 #5
0
 def test_load_new_products_empty(self):
     my_store = Store("Ardes")
     new_laptop = Laptop('HP HackBook', 1000, 1243, 1000, 4)
     self.assertEqual(20, my_store.load_new_products(new_laptop, 20))