Exemplo n.º 1
0
 def test_retrieve_deficiency(self):
     structure = Structure(type=Storage, space=1)
     storage = structure.create(location='None')
     product = Product(type=Food,storage=Storage)
     food = product.create()
     storage.store(food)
     self.assertRaises(StorageException, lambda: storage.retrieve(product,2))
Exemplo n.º 2
0
 def test_split(self):
     amounts = (2,1)
     product = Product(type=Food)
     food = product.create(amount=amounts[0])
     soom_food = food.split(amounts[1])
     self.assertEqual(soom_food.amount, amounts[1])
     self.assertEqual(food.amount, amounts[0]-amounts[1])
Exemplo n.º 3
0
 def test_stack(self):
     amounts = (1,2)
     product = Product(type=Food)
     some_food = product.create(amount=amounts[0])
     more_food = product.create(amount=amounts[1])
     more_food.stack(some_food)
     self.assertEqual(some_food.amount, 0)
     self.assertEqual(more_food.amount, amounts[0]+amounts[1])
Exemplo n.º 4
0
 def test_retrieve_mixed_spec(self):
     structure = Structure(type=Storage, space=1)
     storage = structure.create(location='None')
     good_product = Product(type=Food,storage=Storage,quality=1)
     bad_product = Product(type=Food,storage=Storage,quality=0)
     bad_food = bad_product.create()
     storage.store(bad_food)
     self.assertRaises(StorageException, lambda: storage.retrieve(good_product,1))
Exemplo n.º 5
0
 def test_retrieve_deficiency(self):
     structure = Structure(type=Storage, space=1)
     storage = structure.create(location='None')
     product = Product(type=Food, storage=Storage)
     food = product.create()
     storage.store(food)
     self.assertRaises(StorageException,
                       lambda: storage.retrieve(product, 2))
Exemplo n.º 6
0
 def test_store(self):
     structure = Structure(type=Storage, space=1)
     storage = structure.create(location='None')
     product = Product(type=Food,storage=Storage)
     food = product.create()
     storage.store(food)
     self.assertEqual(storage.stock(product), 1)
     self.assertEqual(storage.space(), 0)
     self.assertEqual(food.amount, 0)
Exemplo n.º 7
0
 def test_retrieve_mixed_spec(self):
     structure = Structure(type=Storage, space=1)
     storage = structure.create(location='None')
     good_product = Product(type=Food, storage=Storage, quality=1)
     bad_product = Product(type=Food, storage=Storage, quality=0)
     bad_food = bad_product.create()
     storage.store(bad_food)
     self.assertRaises(StorageException,
                       lambda: storage.retrieve(good_product, 1))
Exemplo n.º 8
0
 def test_store(self):
     structure = Structure(type=Storage, space=1)
     storage = structure.create(location='None')
     product = Product(type=Food, storage=Storage)
     food = product.create()
     storage.store(food)
     self.assertEqual(storage.stock(product), 1)
     self.assertEqual(storage.space(), 0)
     self.assertEqual(food.amount, 0)
Exemplo n.º 9
0
 def test_storage_amount(self):
     products = 2
     spaces = 3
     structure = Structure(type=Storage, space=1)
     storage = structure.create(amount=spaces, location='None')
     product = Product(type=Food,storage=Storage)
     food = product.create(amount=products)
     storage.store(food)
     self.assertEqual(storage.stock(product),products)
     self.assertEqual(storage.space(), spaces-products)
Exemplo n.º 10
0
 def test_storage_amount(self):
     products = 2
     spaces = 3
     structure = Structure(type=Storage, space=1)
     storage = structure.create(amount=spaces, location='None')
     product = Product(type=Food, storage=Storage)
     food = product.create(amount=products)
     storage.store(food)
     self.assertEqual(storage.stock(product), products)
     self.assertEqual(storage.space(), spaces - products)
Exemplo n.º 11
0
 def test_split_deficiency(self):
     product = Product(type=Food)
     amounts = (1,2)
     some_food = product.create(amount=amounts[0])
     self.assertRaises(StackException, lambda: some_food.split(amounts[1]))
Exemplo n.º 12
0
 def test_stack_mixed_spec(self):
     product = ( Product(type=Food, quality=0), Product(type=Food, quality=1))
     bad_food = product[0].create()
     good_food = product[1].create()
     self.assertRaises(StackException, lambda: bad_food.stack(good_food)) 
Exemplo n.º 13
0
 def test_store_full(self):
     structure = Structure(type=Storage, space=1)
     storage = structure.create(location='None')
     product = Product(type=Food,storage=Storage)
     food = product.create(amount=2)
     self.assertRaises(StorageException, lambda: storage.store(food))
Exemplo n.º 14
0
 def test_store_full(self):
     structure = Structure(type=Storage, space=1)
     storage = structure.create(location='None')
     product = Product(type=Food, storage=Storage)
     food = product.create(amount=2)
     self.assertRaises(StorageException, lambda: storage.store(food))