@@ -39,11 +39,10 @@ def test_can_allocate_to_shipment():
3939
4040
4141def test_ignores_invalid_stock ():
42- sku1 , sku2 = random_id (), random_id ()
43- order = [OrderLine (sku = sku1 , quantity = 10 ), ]
44- stock = [Line (sku = sku2 , quantity = 1000 )]
42+ order = [OrderLine (sku = 'sku1' , quantity = 10 ), ]
43+ stock = [Line (sku = 'sku2' , quantity = 1000 )]
4544 shipment = Shipment (id = random_id (), eta = date .today (), lines = [
46- Line (sku = sku1 , quantity = 1000 ),
45+ Line (sku = ' sku1' , quantity = 1000 ),
4746 ])
4847
4948 allocate (order , stock = stock , shipments = [shipment ])
@@ -52,13 +51,12 @@ def test_ignores_invalid_stock():
5251
5352
5453def test_can_allocate_to_correct_shipment ():
55- sku1 , sku2 = random_id (), random_id ()
56- order = [OrderLine (sku = sku2 , quantity = 10 )]
54+ order = [OrderLine (sku = 'sku2' , quantity = 10 )]
5755 shipment1 = Shipment (id = random_id (), eta = date .today (), lines = [
58- Line (sku = sku1 , quantity = 1000 ),
56+ Line (sku = ' sku1' , quantity = 1000 ),
5957 ])
6058 shipment2 = Shipment (id = random_id (), eta = date .today (), lines = [
61- Line (sku = sku2 , quantity = 1000 ),
59+ Line (sku = ' sku2' , quantity = 1000 ),
6260 ])
6361
6462 allocate (order , stock = [], shipments = [shipment1 , shipment2 ])
@@ -80,14 +78,13 @@ def test_allocates_to_stock_in_preference_to_shipment():
8078
8179
8280def test_can_allocate_multiple_lines_to_wh ():
83- sku1 , sku2 = random_id (), random_id ()
8481 order = [
85- OrderLine (sku = sku1 , quantity = 10 ),
86- OrderLine (sku = sku2 , quantity = 10 ),
82+ OrderLine (sku = ' sku1' , quantity = 10 ),
83+ OrderLine (sku = ' sku2' , quantity = 10 ),
8784 ]
8885 stock = [
89- Line (sku = sku1 , quantity = 1000 ),
90- Line (sku = sku2 , quantity = 1000 ),
86+ Line (sku = ' sku1' , quantity = 1000 ),
87+ Line (sku = ' sku2' , quantity = 1000 ),
9188 ]
9289
9390 allocate (order , stock , shipments = [])
@@ -96,14 +93,13 @@ def test_can_allocate_multiple_lines_to_wh():
9693
9794
9895def test_can_allocate_multiple_lines_to_shipment ():
99- sku1 , sku2 = random_id (), random_id ()
10096 order = [
101- OrderLine (sku = sku1 , quantity = 10 ),
102- OrderLine (sku = sku2 , quantity = 10 ),
97+ OrderLine (sku = ' sku1' , quantity = 10 ),
98+ OrderLine (sku = ' sku2' , quantity = 10 ),
10399 ]
104100 shipment = Shipment (id = random_id (), eta = date .today (), lines = [
105- Line (sku = sku1 , quantity = 1000 ),
106- Line (sku = sku2 , quantity = 1000 ),
101+ Line (sku = ' sku1' , quantity = 1000 ),
102+ Line (sku = ' sku2' , quantity = 1000 ),
107103 ])
108104
109105 allocate (order , [], shipments = [shipment ])
@@ -113,15 +109,14 @@ def test_can_allocate_multiple_lines_to_shipment():
113109
114110
115111def test_can_allocate_to_both ():
116- sku1 , sku2 = random_id (), random_id ()
117112 order = [
118- OrderLine (sku = sku1 , quantity = 10 ),
119- OrderLine (sku = sku2 , quantity = 10 ),
113+ OrderLine (sku = ' sku1' , quantity = 10 ),
114+ OrderLine (sku = ' sku2' , quantity = 10 ),
120115 ]
121116 shipment = Shipment (id = random_id (), eta = date .today (), lines = [
122- Line (sku = sku2 , quantity = 1000 ),
117+ Line (sku = ' sku2' , quantity = 1000 ),
123118 ])
124- stock = [Line (sku = sku1 , quantity = 1000 )]
119+ stock = [Line (sku = ' sku1' , quantity = 1000 )]
125120
126121 allocate (order , stock , shipments = [shipment ])
127122
@@ -130,21 +125,20 @@ def test_can_allocate_to_both():
130125
131126
132127def test_can_allocate_to_both_preferring_stock ():
133- sku1 , sku2 , sku3 , sku4 = [random_id () for _ in range (4 )]
134128 order = [
135- OrderLine (sku = sku1 , quantity = 10 ),
136- OrderLine (sku = sku2 , quantity = 10 ),
137- OrderLine (sku = sku3 , quantity = 10 ),
138- OrderLine (sku = sku4 , quantity = 10 ),
129+ OrderLine (sku = ' sku1' , quantity = 10 ),
130+ OrderLine (sku = ' sku2' , quantity = 10 ),
131+ OrderLine (sku = ' sku3' , quantity = 10 ),
132+ OrderLine (sku = ' sku4' , quantity = 10 ),
139133 ]
140134 shipment = Shipment (id = random_id (), eta = date .today (), lines = [
141- Line (sku = sku1 , quantity = 1000 ),
142- Line (sku = sku2 , quantity = 1000 ),
143- Line (sku = sku3 , quantity = 1000 ),
135+ Line (sku = ' sku1' , quantity = 1000 ),
136+ Line (sku = ' sku2' , quantity = 1000 ),
137+ Line (sku = ' sku3' , quantity = 1000 ),
144138 ])
145139 stock = [
146- Line (sku = sku3 , quantity = 1000 ),
147- Line (sku = sku4 , quantity = 1000 ),
140+ Line (sku = ' sku3' , quantity = 1000 ),
141+ Line (sku = ' sku4' , quantity = 1000 ),
148142 ]
149143
150144 allocate (order , stock , shipments = [shipment ])
@@ -156,16 +150,15 @@ def test_can_allocate_to_both_preferring_stock():
156150
157151
158152def test_mixed_allocations_are_avoided_if_possible ():
159- sku1 , sku2 = random_id (), random_id ()
160153 order = [
161- OrderLine (sku = sku1 , quantity = 10 ),
162- OrderLine (sku = sku2 , quantity = 10 ),
154+ OrderLine (sku = ' sku1' , quantity = 10 ),
155+ OrderLine (sku = ' sku2' , quantity = 10 ),
163156 ]
164157 shipment = Shipment (id = random_id (), eta = date .today (), lines = [
165- Line (sku = sku1 , quantity = 1000 ),
166- Line (sku = sku2 , quantity = 1000 ),
158+ Line (sku = ' sku1' , quantity = 1000 ),
159+ Line (sku = ' sku2' , quantity = 1000 ),
167160 ])
168- stock = [Line (sku = sku1 , quantity = 1000 )]
161+ stock = [Line (sku = ' sku1' , quantity = 1000 )]
169162
170163 allocate (order , stock , shipments = [shipment ])
171164
@@ -174,19 +167,18 @@ def test_mixed_allocations_are_avoided_if_possible():
174167
175168
176169def test_prefer_allocating_to_earlier_shipment ():
177- sku1 , sku2 = random_id (), random_id ()
178170 order = [
179- OrderLine (sku = sku1 , quantity = 10 ),
180- OrderLine (sku = sku2 , quantity = 10 ),
171+ OrderLine (sku = ' sku1' , quantity = 10 ),
172+ OrderLine (sku = ' sku2' , quantity = 10 ),
181173 ]
182174 shipment1 = Shipment (id = random_id (), eta = date .today (), lines = [
183- Line (sku = sku1 , quantity = 1000 ),
184- Line (sku = sku2 , quantity = 1000 ),
175+ Line (sku = ' sku1' , quantity = 1000 ),
176+ Line (sku = ' sku2' , quantity = 1000 ),
185177 ])
186178 tomorrow = date .today () + timedelta (days = 1 )
187179 shipment2 = Shipment (id = random_id (), eta = tomorrow , lines = [
188- Line (sku = sku1 , quantity = 1000 ),
189- Line (sku = sku2 , quantity = 1000 ),
180+ Line (sku = ' sku1' , quantity = 1000 ),
181+ Line (sku = ' sku2' , quantity = 1000 ),
190182 ])
191183 stock = []
192184
0 commit comments