Beispiel #1
0
 def test_creating_specified_inventory(self):
     object = MobileInventory({})
     object.add_stock({
         'iPhone Model X': 100,
         'Xiaomi Model Y': 1000,
         'Nokia Model Z': 25
     })
Beispiel #2
0
 def setup_class(self):
     self.inventory = MobileInventory({
         'iPhone Model X': 100,
         'Xiaomi Model Y': 1000,
         'Nokia Model Z': 25
     })
     return self.inventory
Beispiel #3
0
 def test_creating_inventory_with_negative_value(self):
     with pytest.raises(ValueError):
         object = MobileInventory({
             'iPhone Model X': -45,
             'Xiaomi Model Y': 200,
             'Nokia Model Z': 25
         })
Beispiel #4
0
 def test_creating_inventory_with_nonnumeric_values(self):
     with pytest.raises(ValueError):
         object = MobileInventory({
             'iPhone Model X': '100',
             'Xiaomi Model Y': '1000',
             'Nokia Model Z': '25'
         })
Beispiel #5
0
 def test_creating_inventory_with_numeric_keys(self):
     with pytest.raises(ValueError):
         object = MobileInventory({
             1: 'iPhone Model X',
             2: 'Xiaomi Model Y',
             3: 'Nokia Model Z'
         })
Beispiel #6
0
 def setup_class(self):
     self.inventory = MobileInventory({
         'iPhone Model A': 50,
         'Xiaomi Model B': 2000,
         'Nokia Model C': 10,
         'Sony Model D': 1
     })
     return self.inventory
Beispiel #7
0
 def test_creating_empty_inventory(self):
     object = MobileInventory({})
Beispiel #8
0
 def test_creating_inventory_with_list(self):
     with pytest.raises(TypeError):
         object = MobileInventory(
             ['iPhone Model X', 'Xiaomi Model Y', 'Nokia Model Z'])