Skip to content

Commit fdcc789

Browse files
committed
found a bug. time for bed surely
1 parent 4945d35 commit fdcc789

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test_allocation.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,20 @@ def test_prefer_allocating_to_earlier_even_if_multiple_shipments():
198198
assert allocations['sku3'] == shipment2
199199

200200

201+
def test_stock_not_quite_enough_means_we_use_shipment():
202+
order = {'sku1': 10, 'sku2': 10}
203+
stock = {'sku1': 10, 'sku2': 5}
204+
shipment = Shipment(eta=date.today(), lines={
205+
'sku1': 1000,
206+
'sku2': 1000,
207+
})
208+
209+
allocations = allocate(order, stock, shipments=[shipment])
210+
211+
assert allocations['sku1'] == shipment
212+
assert allocations['sku2'] == shipment
213+
214+
201215
def test_cannot_allocate_if_insufficent_quantity_in_stock():
202216
order = {'a-sku': 10}
203217
stock = {'a-sku': 5}

0 commit comments

Comments
 (0)