@@ -224,6 +224,134 @@ def test_get_lanes_list_2():
224224 )
225225
226226
227+ def test_get_lane_impacts_santa_fe ():
228+ lane_impacts = [
229+ {
230+ "direction" : "north" ,
231+ "laneCount" : 2 ,
232+ "laneClosures" : "6000" ,
233+ "closedLaneTypes" : ["left lane" , "right lane" ],
234+ },
235+ {
236+ "direction" : "south" ,
237+ "laneCount" : 2 ,
238+ "laneClosures" : "0" ,
239+ "closedLaneTypes" : [],
240+ },
241+ ]
242+ direction = "north"
243+ has_alternating_traffic = False
244+ expected = [
245+ {"order" : 1 , "type" : "general" , "status" : "closed" },
246+ {"order" : 2 , "type" : "general" , "status" : "closed" },
247+ ]
248+ actual = planned_events .get_lane_impacts (
249+ lane_impacts , direction , has_alternating_traffic
250+ )
251+ assert actual == expected
252+
253+ direction = "south"
254+ expected = [
255+ {"order" : 1 , "type" : "general" , "status" : "open" },
256+ {"order" : 2 , "type" : "general" , "status" : "open" },
257+ ]
258+ actual = planned_events .get_lane_impacts (
259+ lane_impacts , direction , has_alternating_traffic
260+ )
261+ assert actual == expected
262+
263+ # Alternating traffic
264+ has_alternating_traffic = True
265+
266+ direction = "north"
267+ expected = [
268+ {"order" : 1 , "type" : "general" , "status" : "alternating-flow" },
269+ {"order" : 2 , "type" : "general" , "status" : "closed" },
270+ ]
271+ actual = planned_events .get_lane_impacts (
272+ lane_impacts , direction , has_alternating_traffic
273+ )
274+ assert actual == expected
275+
276+ direction = "south"
277+ expected = [
278+ {"order" : 1 , "type" : "general" , "status" : "alternating-flow" },
279+ {"order" : 2 , "type" : "general" , "status" : "closed" },
280+ ]
281+ actual = planned_events .get_lane_impacts (
282+ lane_impacts , direction , has_alternating_traffic
283+ )
284+ assert actual == expected
285+
286+
287+ def test_get_lane_impacts_el_paso ():
288+ lane_impacts = [
289+ {
290+ "direction" : "north" ,
291+ "laneCount" : 4 ,
292+ "laneClosures" : "800" ,
293+ "closedLaneTypes" : ["right lane" ],
294+ },
295+ {
296+ "direction" : "south" ,
297+ "laneCount" : 4 ,
298+ "laneClosures" : "800" ,
299+ "closedLaneTypes" : ["right lane" ],
300+ },
301+ ]
302+ direction = "north"
303+ has_alternating_traffic = False
304+ expected = [
305+ {"order" : 1 , "type" : "general" , "status" : "open" },
306+ {"order" : 2 , "type" : "general" , "status" : "open" },
307+ {"order" : 3 , "type" : "general" , "status" : "open" },
308+ {"order" : 4 , "type" : "general" , "status" : "closed" },
309+ ]
310+ actual = planned_events .get_lane_impacts (
311+ lane_impacts , direction , has_alternating_traffic
312+ )
313+ assert actual == expected
314+
315+ direction = "south"
316+ expected = [
317+ {"order" : 1 , "type" : "general" , "status" : "open" },
318+ {"order" : 2 , "type" : "general" , "status" : "open" },
319+ {"order" : 3 , "type" : "general" , "status" : "open" },
320+ {"order" : 4 , "type" : "general" , "status" : "closed" },
321+ ]
322+ actual = planned_events .get_lane_impacts (
323+ lane_impacts , direction , has_alternating_traffic
324+ )
325+ assert actual == expected
326+
327+ # Alternating traffic
328+ has_alternating_traffic = True
329+
330+ direction = "north"
331+ expected = [
332+ {"order" : 1 , "type" : "general" , "status" : "alternating-flow" },
333+ {"order" : 2 , "type" : "general" , "status" : "closed" },
334+ {"order" : 3 , "type" : "general" , "status" : "closed" },
335+ {"order" : 4 , "type" : "general" , "status" : "closed" },
336+ ]
337+ actual = planned_events .get_lane_impacts (
338+ lane_impacts , direction , has_alternating_traffic
339+ )
340+ assert actual == expected
341+
342+ direction = "south"
343+ expected = [
344+ {"order" : 1 , "type" : "general" , "status" : "alternating-flow" },
345+ {"order" : 2 , "type" : "general" , "status" : "closed" },
346+ {"order" : 3 , "type" : "general" , "status" : "closed" },
347+ {"order" : 4 , "type" : "general" , "status" : "closed" },
348+ ]
349+ actual = planned_events .get_lane_impacts (
350+ lane_impacts , direction , has_alternating_traffic
351+ )
352+ assert actual == expected
353+
354+
227355# --------------------------------------------------------------------------------Unit test for get_vehicle_impact function--------------------------------------------------------------------------------
228356def test_get_vehicle_impact_some_lanes_closed ():
229357 lanes = [
0 commit comments