@@ -71,7 +71,9 @@ def test_get_vehicle_impact_some_lanes_closed():
7171 {"order" : 3 , "type" : "general" , "status" : "closed" },
7272 {"order" : 4 , "type" : "shoulder" , "status" : "open" },
7373 ]
74- test_vehicle_impact = planned_events_translator .get_vehicle_impact (lanes )
74+ test_vehicle_impact = planned_events_translator .get_vehicle_impact (
75+ lanes , "description"
76+ )
7577 expected_vehicle_impact = "some-lanes-closed"
7678 assert test_vehicle_impact == expected_vehicle_impact
7779
@@ -83,7 +85,9 @@ def test_get_vehicle_impact_all_lanes_closed():
8385 {"order" : 3 , "type" : "general" , "status" : "closed" },
8486 {"order" : 4 , "type" : "shoulder" , "status" : "closed" },
8587 ]
86- test_vehicle_impact = planned_events_translator .get_vehicle_impact (lanes )
88+ test_vehicle_impact = planned_events_translator .get_vehicle_impact (
89+ lanes , "description"
90+ )
8791 expected_vehicle_impact = "all-lanes-closed"
8892 assert test_vehicle_impact == expected_vehicle_impact
8993
@@ -95,11 +99,52 @@ def test_get_vehicle_impact_all_lanes_open():
9599 {"order" : 3 , "type" : "general" , "status" : "open" },
96100 {"order" : 4 , "type" : "shoulder" , "status" : "open" },
97101 ]
98- test_vehicle_impact = planned_events_translator .get_vehicle_impact (lanes )
102+ test_vehicle_impact = planned_events_translator .get_vehicle_impact (
103+ lanes , "description"
104+ )
99105 expected_vehicle_impact = "all-lanes-open"
100106 assert test_vehicle_impact == expected_vehicle_impact
101107
102108
109+ def test_get_vehicle_impact_alternating_description_valid ():
110+ lanes = [
111+ {"order" : 1 , "type" : "shoulder" , "status" : "open" },
112+ {"order" : 2 , "type" : "general" , "status" : "closed" },
113+ {"order" : 3 , "type" : "general" , "status" : "open" },
114+ {"order" : 4 , "type" : "shoulder" , "status" : "closed" },
115+ ]
116+ test_vehicle_impact = planned_events_translator .get_vehicle_impact (
117+ lanes ,
118+ "Between Utopia Place and CO 14 (Laporte) from Mile Point 354.5 to Mile Point 355.7. Paving operations. Alternating traffic. "
119+ "Starting June 5, 2025 at 7:00AM MDT until June 5, 2025 at about 5:00PM MDT. Full schedule below: \u2022 June 5, 7:00AM - "
120+ "June 5, 5:00PM Comment: Delays of up to 15 minutes can be anticipated. The speed limit will be reduced to 40 mph through the "
121+ "work zone. More project information is available at 970-632-7440 or sherry@sawpr.com." ,
122+ )
123+ expected_vehicle_impact = "alternating-one-way"
124+ assert test_vehicle_impact == expected_vehicle_impact
125+
126+
127+ def test_get_vehicle_impact_alternating_comment_invalid ():
128+ lanes = [
129+ {"order" : 1 , "type" : "shoulder" , "status" : "open" },
130+ {"order" : 2 , "type" : "general" , "status" : "closed" },
131+ {"order" : 3 , "type" : "general" , "status" : "open" },
132+ {"order" : 4 , "type" : "shoulder" , "status" : "closed" },
133+ ]
134+ test_vehicle_impact = planned_events_translator .get_vehicle_impact (
135+ lanes ,
136+ "Between 3300 Road and Pleasure Park Road (1 to 4 miles west of Hotchkiss) from Mile Point 18.9 to Mile Point 15.6. "
137+ "Road construction. Starting June 5, 2025 at 6:01AM MDT until June 5, 2025 at about 6:00PM MDT. Full schedule below: "
138+ "\u2022 June 5, 6:01AM - June 5, 6:00PM Comment: Shoulder widening will start on the north side. Crews continue pipe "
139+ "installation and waterline work between Mile Point 15-16 in both the eastbound and westbound direction. Alternating "
140+ "single lane traffic under flagger control will be implemented throughout the work zone and delays are expected during "
141+ "peak commuter times. Motorists should expect delays through the work zone. There will be one lane alternating traffic "
142+ "during the majority of the project and shoulder closures as needed and periodic traffic stops in order to move equipment." ,
143+ )
144+ expected_vehicle_impact = "some-lanes-closed"
145+ assert test_vehicle_impact == expected_vehicle_impact
146+
147+
103148# --------------------------------------------------------------------------------Unit test for wzdx_creator function--------------------------------------------------------------------------------
104149@patch .dict (
105150 os .environ ,
0 commit comments