Skip to content

Commit 6f727d8

Browse files
committed
stop caring about quantity. someone elses problem
1 parent fdcc789 commit 6f727d8

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

domain_model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def skus(d):
1010

1111
def allocate_line(sku, quantity, source, allocations):
1212
if source.get(sku, 0) > quantity:
13-
source[sku] -= quantity
1413
allocations[sku] = source
1514

1615

test_allocation.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def test_can_allocate_to_stock():
1919
allocations = allocate(order, stock, shipments=[])
2020

2121
assert allocations['a-sku'] == stock
22-
assert stock['a-sku'] == 990
2322

2423

2524
def test_can_allocate_to_shipment():
@@ -31,7 +30,6 @@ def test_can_allocate_to_shipment():
3130
allocations = allocate(order, stock={}, shipments=[shipment])
3231

3332
assert allocations['a-sku'] == shipment
34-
assert shipment['a-sku'] == 990
3533

3634

3735
def test_ignores_irrelevant_stock():
@@ -44,8 +42,6 @@ def test_ignores_irrelevant_stock():
4442
allocations = allocate(order, stock=stock, shipments=[shipment])
4543

4644
assert allocations['sku1'] == shipment
47-
assert stock['sku2'] == 1000
48-
assert shipment['sku1'] == 990
4945

5046

5147
def test_can_allocate_to_correct_shipment():
@@ -60,8 +56,6 @@ def test_can_allocate_to_correct_shipment():
6056
allocations = allocate(order, stock={}, shipments=[shipment1, shipment2])
6157

6258
assert allocations['sku2'] == shipment2
63-
assert shipment1['sku1'] == 1000
64-
assert shipment2['sku2'] == 990
6559

6660

6761
def test_allocates_to_stock_in_preference_to_shipment():
@@ -74,8 +68,6 @@ def test_allocates_to_stock_in_preference_to_shipment():
7468
allocations = allocate(order, stock, shipments=[shipment])
7569

7670
assert allocations['sku1'] == stock
77-
assert stock['sku1'] == 990
78-
assert shipment['sku1'] == 1000
7971

8072

8173
def test_can_allocate_multiple_lines_to_wh():
@@ -85,8 +77,6 @@ def test_can_allocate_multiple_lines_to_wh():
8577
allocations = allocate(order, stock, shipments=[])
8678
assert allocations['sku1'] == stock
8779
assert allocations['sku2'] == stock
88-
assert stock['sku1'] == 995
89-
assert stock['sku2'] == 990
9080

9181

9282
def test_can_allocate_multiple_lines_to_shipment():
@@ -100,8 +90,6 @@ def test_can_allocate_multiple_lines_to_shipment():
10090

10191
assert allocations['sku1'] == shipment
10292
assert allocations['sku2'] == shipment
103-
assert shipment['sku1'] == 995
104-
assert shipment['sku2'] == 990
10593

10694

10795
def test_can_allocate_to_both():
@@ -115,8 +103,6 @@ def test_can_allocate_to_both():
115103

116104
assert allocations['sku1'] == stock
117105
assert allocations['sku2'] == shipment
118-
assert stock['sku1'] == 995
119-
assert shipment['sku2'] == 990
120106

121107

122108
def test_can_allocate_to_both_preferring_stock():
@@ -134,11 +120,6 @@ def test_can_allocate_to_both_preferring_stock():
134120
assert allocations['sku2'] == shipment
135121
assert allocations['sku3'] == stock
136122
assert allocations['sku4'] == stock
137-
assert shipment['sku1'] == 999
138-
assert shipment['sku2'] == 998
139-
assert shipment['sku3'] == 1000
140-
assert stock['sku3'] == 997
141-
assert stock['sku4'] == 996
142123

143124

144125
def test_mixed_allocations_are_avoided_if_possible():
@@ -231,15 +212,3 @@ def test_cannot_allocate_if_insufficent_quantity_in_shipment():
231212

232213
assert 'a-sku' not in allocations
233214

234-
235-
def test_cannot_allocate_more_orders_than_we_have_stock_for():
236-
order1 = {'a-sku': 10}
237-
order2 = {'a-sku': 10}
238-
stock = {'a-sku': 15}
239-
240-
allocations1 = allocate(order1, stock, shipments=[])
241-
allocations2 = allocate(order2, stock, shipments=[])
242-
243-
assert 'a-sku' in allocations1
244-
assert 'a-sku' not in allocations2
245-

0 commit comments

Comments
 (0)