Skip to content

Commit 566923e

Browse files
committed
Finalizing alternating-one-way processing
1 parent 232a974 commit 566923e

File tree

12 files changed

+35202
-12755
lines changed

12 files changed

+35202
-12755
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pathlib
55
from setuptools import setup, find_packages
66

7-
VERSION = "1.4.0-rc.1"
7+
VERSION = "1.4.2"
88
DESCRIPTION = "CDOT Work Zone WZDx Translators"
99
HERE = pathlib.Path(__file__).parent
1010
README = (HERE / "README.md").read_text()

tests/data/raw_to_standard/planned_events_test_expected_results.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,14 +330,14 @@
330330
"MMax": 449.589,
331331
"MMin": 0.0,
332332
"Measure": 60.0,
333-
"Route": "070A_DEC",
333+
"Route": "070A",
334334
},
335335
"route_details_start": {
336336
"Distance": 0.91,
337337
"MMax": 449.589,
338338
"MMin": 0.0,
339339
"Measure": 50.0,
340-
"Route": "070A_DEC",
340+
"Route": "070A",
341341
},
342342
"condition_1": False,
343343
"beginning_milepost": 50.0,

tests/standard_to_wzdx/planned_events_translator_test.py

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)