def test_MultipleOrders_ValidShipment_MultipleProviding_MultipleWarehouses(
         self):
     order = {'apple': 1, 'orange': 2}
     inventory_distribution = [{
         'name': 'dm',
         'inventory': {
             'apple': 1,
             'orange': 1
         }
     }, {
         'name': 'owd',
         'inventory': {
             'orange': 1
         }
     }]
     shipment = InventoryAllocation.find_shipment(order,
                                                  inventory_distribution)
     self.assertEqual(shipment, [{
         'dm': {
             'apple': 1,
             'orange': 1
         }
     }, {
         'owd': {
             'orange': 1
         }
     }])
 def test_OneOrder_InvalidShipment__OneProviding_OneWarehouse(self):
     order = {'apple': 1}
     inventory_distribution = [{'name': 'owd', 'inventory': {'apple': 0}}]
     shipment = InventoryAllocation.find_shipment(order,
                                                  inventory_distribution)
     self.assertEqual(shipment, [])
 def test_NameInDistributionIsNonString_TypeError(self):
     order = {'apple': 1}
     inventory_distribution = [{'name': 1, 'inventory': {'apple': 1}}]
     with self.assertRaises(TypeError):
         InventoryAllocation.find_shipment(order, inventory_distribution)
 def test_InventoryAmountIsString_TypeError(self):
     order = {'apple': 1}
     inventory_distribution = [{'name': 'owd', 'inventory': {'apple': '1'}}]
     with self.assertRaises(TypeError):
         InventoryAllocation.find_shipment(order, inventory_distribution)
 def test_surplusInventory(self):
     order = {'apple': 1}
     inventory_distribution = [{'name': 'owd', 'inventory': {'apple': 10}}]
     shipment = InventoryAllocation.find_shipment(order,
                                                  inventory_distribution)
     self.assertEqual(shipment, [{'owd': {'apple': 1}}])
 def test_OrderIsNotPresent(self):
     order = {'apple': 1, 'orange': 2}
     inventory_distribution = [{'name': 'owd', 'inventory': {'Banana': 1}}]
     shipment = InventoryAllocation.find_shipment(order,
                                                  inventory_distribution)
     self.assertEqual(shipment, [])