@@ -18,7 +18,7 @@ def test_can_allocate_to_stock():
1818
1919 allocations = allocate (order , stock , shipments = [])
2020
21- assert allocations ['a-sku' ] == 'STOCK'
21+ assert allocations ['a-sku' ] == stock
2222 assert stock ['a-sku' ] == 990
2323
2424
@@ -30,7 +30,7 @@ def test_can_allocate_to_shipment():
3030
3131 allocations = allocate (order , stock = {}, shipments = [shipment ])
3232
33- assert allocations ['a-sku' ] == shipment . id
33+ assert allocations ['a-sku' ] == shipment
3434 assert shipment ['a-sku' ] == 990
3535
3636
@@ -43,7 +43,7 @@ def test_ignores_irrelevant_stock():
4343
4444 allocations = allocate (order , stock = stock , shipments = [shipment ])
4545
46- assert allocations ['sku1' ] == shipment . id
46+ assert allocations ['sku1' ] == shipment
4747 assert stock ['sku2' ] == 1000
4848 assert shipment ['sku1' ] == 990
4949
@@ -59,7 +59,7 @@ def test_can_allocate_to_correct_shipment():
5959
6060 allocations = allocate (order , stock = {}, shipments = [shipment1 , shipment2 ])
6161
62- assert allocations ['sku2' ] == shipment2 . id
62+ assert allocations ['sku2' ] == shipment2
6363 assert shipment1 ['sku1' ] == 1000
6464 assert shipment2 ['sku2' ] == 990
6565
@@ -73,7 +73,7 @@ def test_allocates_to_stock_in_preference_to_shipment():
7373
7474 allocations = allocate (order , stock , shipments = [shipment ])
7575
76- assert allocations ['sku1' ] == 'STOCK'
76+ assert allocations ['sku1' ] == stock
7777 assert stock ['sku1' ] == 990
7878 assert shipment ['sku1' ] == 1000
7979
@@ -83,8 +83,8 @@ def test_can_allocate_multiple_lines_to_wh():
8383 stock = {'sku1' : 1000 , 'sku2' : 1000 }
8484
8585 allocations = allocate (order , stock , shipments = [])
86- assert allocations ['sku1' ] == 'STOCK'
87- assert allocations ['sku2' ] == 'STOCK'
86+ assert allocations ['sku1' ] == stock
87+ assert allocations ['sku2' ] == stock
8888 assert stock ['sku1' ] == 995
8989 assert stock ['sku2' ] == 990
9090
@@ -98,8 +98,8 @@ def test_can_allocate_multiple_lines_to_shipment():
9898
9999 allocations = allocate (order , stock = {}, shipments = [shipment ])
100100
101- assert allocations ['sku1' ] == shipment . id
102- assert allocations ['sku2' ] == shipment . id
101+ assert allocations ['sku1' ] == shipment
102+ assert allocations ['sku2' ] == shipment
103103 assert shipment ['sku1' ] == 995
104104 assert shipment ['sku2' ] == 990
105105
@@ -113,8 +113,8 @@ def test_can_allocate_to_both():
113113
114114 allocations = allocate (order , stock , shipments = [shipment ])
115115
116- assert allocations ['sku1' ] == 'STOCK'
117- assert allocations ['sku2' ] == shipment . id
116+ assert allocations ['sku1' ] == stock
117+ assert allocations ['sku2' ] == shipment
118118 assert stock ['sku1' ] == 995
119119 assert shipment ['sku2' ] == 990
120120
@@ -130,10 +130,10 @@ def test_can_allocate_to_both_preferring_stock():
130130
131131 allocations = allocate (order , stock , shipments = [shipment ])
132132
133- assert allocations ['sku1' ] == shipment . id
134- assert allocations ['sku2' ] == shipment . id
135- assert allocations ['sku3' ] == 'STOCK'
136- assert allocations ['sku4' ] == 'STOCK'
133+ assert allocations ['sku1' ] == shipment
134+ assert allocations ['sku2' ] == shipment
135+ assert allocations ['sku3' ] == stock
136+ assert allocations ['sku4' ] == stock
137137 assert shipment ['sku1' ] == 999
138138 assert shipment ['sku2' ] == 998
139139 assert shipment ['sku3' ] == 1000
@@ -151,8 +151,8 @@ def test_mixed_allocations_are_avoided_if_possible():
151151
152152 allocations = allocate (order , stock , shipments = [shipment ])
153153
154- assert allocations ['sku1' ] == shipment . id
155- assert allocations ['sku2' ] == shipment . id
154+ assert allocations ['sku1' ] == shipment
155+ assert allocations ['sku2' ] == shipment
156156
157157
158158def test_prefer_allocating_to_earlier_shipment ():
@@ -170,8 +170,8 @@ def test_prefer_allocating_to_earlier_shipment():
170170
171171 allocations = allocate (order , stock , shipments = [shipment2 , shipment1 ])
172172
173- assert allocations ['sku1' ] == shipment1 . id
174- assert allocations ['sku2' ] == shipment1 . id
173+ assert allocations ['sku1' ] == shipment1
174+ assert allocations ['sku2' ] == shipment1
175175
176176
177177def test_prefer_allocating_to_earlier_even_if_multiple_shipments ():
@@ -193,9 +193,9 @@ def test_prefer_allocating_to_earlier_even_if_multiple_shipments():
193193
194194 allocations = allocate (order , stock , shipments = [shipment3 , shipment2 , shipment1 ])
195195
196- assert allocations ['sku1' ] == shipment1 . id
197- assert allocations ['sku2' ] == shipment2 . id
198- assert allocations ['sku3' ] == shipment2 . id
196+ assert allocations ['sku1' ] == shipment1
197+ assert allocations ['sku2' ] == shipment2
198+ assert allocations ['sku3' ] == shipment2
199199
200200
201201def test_cannot_allocate_if_insufficent_quantity_in_stock ():
0 commit comments