Skip to content

Commit dac03f2

Browse files
committed
Writing cwz feed unit tests
1 parent 7eed847 commit dac03f2

File tree

11 files changed

+1126
-10
lines changed

11 files changed

+1126
-10
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.3.1"
7+
VERSION = "1.4.0"
88
DESCRIPTION = "CDOT Work Zone WZDx Translators"
99
HERE = pathlib.Path(__file__).parent
1010
README = (HERE / "README.md").read_text()
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
test_parse_work_zone_multipoint_standard = {
2+
"rtdh_timestamp": 1642036259.3099449,
3+
"rtdh_message_id": "42fe21b8-102b-43e8-8668-23c55334a201",
4+
"event": {
5+
"type": "work-zone",
6+
"source": {
7+
"id": "OpenTMS-Event1689408506",
8+
"creation_timestamp": 1635531964000,
9+
"last_updated_timestamp": 1635532501835,
10+
},
11+
"geometry": [[-108.279106, 39.195663], [-108.218549, 39.302392]],
12+
"header": {
13+
"description": "Between Exit 49: CO 65; Grand Mesa (5 miles east of the Palisade area) and US 6 (Debeque) from Mile Point 50 to Mile Point 60. Road closed expect delays due to bridge construction. Until May 1, 2022 at about 12:26PM MDT.",
14+
"start_timestamp": 1635531964000,
15+
"end_timestamp": 1651429564000,
16+
},
17+
"detail": {
18+
"road_name": "I-70E",
19+
"road_number": "I-70E",
20+
"direction": "westbound",
21+
},
22+
"additional_info": {
23+
"lanes": [
24+
{"order": 1, "type": "shoulder", "status": "open"},
25+
{"order": 2, "type": "general", "status": "closed"},
26+
{"order": 3, "type": "general", "status": "closed"},
27+
{"order": 4, "type": "shoulder", "status": "open"},
28+
],
29+
"restrictions": [],
30+
"beginning_milepost": 50.0,
31+
"ending_milepost": 60.0,
32+
"types_of_work": [
33+
{"type_name": "below-road-work", "is_architectural_change": True}
34+
],
35+
},
36+
},
37+
}
38+
39+
test_parse_work_zone_multipoint_expected = {
40+
"id": "ce32f52d-1150-5bc9-a9df-7b5c71217d26",
41+
"type": "Feature",
42+
"properties": {
43+
"core_details": {
44+
"data_source_id": "",
45+
"event_type": "work-zone",
46+
"name": "OpenTMS-Event1689408506",
47+
"road_names": ["I-70E"],
48+
"direction": "westbound",
49+
"description": "Between Exit 49: CO 65; Grand Mesa (5 miles east of the Palisade area) and US 6 (Debeque) from Mile Point 50 to Mile Point 60. Road closed expect delays due to bridge construction. Until May 1, 2022 at about 12:26PM MDT.",
50+
"update_date": "2021-10-29T18:35:01Z",
51+
},
52+
"start_date": "2021-10-29T18:26:04Z",
53+
"end_date": "2022-05-01T18:26:04Z",
54+
"location_method": "channel-device-method",
55+
"is_start_date_verified": False,
56+
"is_end_date_verified": False,
57+
"is_start_position_verified": False,
58+
"is_end_position_verified": False,
59+
"vehicle_impact": "some-lanes-closed",
60+
"beginning_milepost": 50.0,
61+
"ending_milepost": 60.0,
62+
"work_zone_type": "static",
63+
"lanes": [
64+
{"order": 1, "type": "shoulder", "status": "open"},
65+
{"order": 2, "type": "general", "status": "closed"},
66+
{"order": 3, "type": "general", "status": "closed"},
67+
{"order": 4, "type": "shoulder", "status": "open"},
68+
],
69+
},
70+
"geometry": {
71+
"type": "MultiPoint",
72+
"coordinates": [[-108.279106, 39.195663], [-108.218549, 39.302392]],
73+
},
74+
}
75+
76+
test_cwz_creator_standard = {
77+
"rtdh_timestamp": 1642036259.3099449,
78+
"rtdh_message_id": "42fe21b8-102b-43e8-8668-23c55334a201",
79+
"event": {
80+
"type": "work-zone",
81+
"types_of_lanes": {
82+
"type_name": "below-road-work",
83+
"is_architectural_change": True,
84+
},
85+
"source": {
86+
"id": "OpenTMS-Event1689408506",
87+
"creation_timestamp": 1635531964000,
88+
"last_updated_timestamp": 1635532501835,
89+
},
90+
"geometry": [[-108.279106, 39.195663], [-108.218549, 39.302392]],
91+
"header": {
92+
"description": "Between Exit 49: CO 65; Grand Mesa (5 miles east of the Palisade area) and US 6 (Debeque) from Mile Point 50 to Mile Point 60. Road closed expect delays due to bridge construction. Until May 1, 2022 at about 12:26PM MDT.",
93+
"start_timestamp": 1635531964000,
94+
"end_timestamp": 1651429564000,
95+
},
96+
"detail": {
97+
"road_name": "I-70E",
98+
"road_number": "I-70E",
99+
"direction": "westbound",
100+
},
101+
"additional_info": {
102+
"lanes": [
103+
{"order": 1, "type": "shoulder", "status": "open"},
104+
{"order": 2, "type": "general", "status": "closed"},
105+
{"order": 3, "type": "general", "status": "closed"},
106+
{"order": 4, "type": "shoulder", "status": "open"},
107+
],
108+
"restrictions": [],
109+
"beginning_milepost": 50.0,
110+
"ending_milepost": 60.0,
111+
},
112+
},
113+
}
114+
115+
test_cwz_creator_expected = {
116+
"feed_info": {
117+
"update_date": "2021-04-13T00:00:00Z",
118+
"publisher": "CDOT",
119+
"contact_name": "Heather Pickering-Hilgers",
120+
"contact_email": "heather.pickeringhilgers@state.co.us",
121+
"update_frequency": 300,
122+
"version": "1.0",
123+
"license": "https://creativecommons.org/publicdomain/zero/1.0/",
124+
"data_sources": [
125+
{
126+
"data_source_id": "w",
127+
"organization_name": "CDOT",
128+
"contact_name": "Heather Pickering-Hilgers",
129+
"contact_email": "heather.pickeringhilgers@state.co.us",
130+
"update_date": "2021-04-13T00:00:00Z",
131+
"update_frequency": 300,
132+
}
133+
],
134+
},
135+
"type": "FeatureCollection",
136+
"features": [
137+
{
138+
"id": "ce32f52d-1150-5bc9-a9df-7b5c71217d26",
139+
"type": "Feature",
140+
"properties": {
141+
"core_details": {
142+
"data_source_id": "w",
143+
"event_type": "work-zone",
144+
"name": "OpenTMS-Event1689408506",
145+
"road_names": ["I-70E"],
146+
"direction": "westbound",
147+
"description": "Between Exit 49: CO 65; Grand Mesa (5 miles east of the Palisade area) and US 6 (Debeque) from Mile Point 50 to Mile Point 60. Road closed expect delays due to bridge construction. Until May 1, 2022 at about 12:26PM MDT.",
148+
"update_date": "2021-10-29T18:35:01Z",
149+
},
150+
"start_date": "2021-10-29T18:26:04Z",
151+
"end_date": "2022-05-01T18:26:04Z",
152+
"location_method": "channel-device-method",
153+
"beginning_milepost": 50.0,
154+
"ending_milepost": 60.0,
155+
"is_start_date_verified": False,
156+
"is_end_date_verified": False,
157+
"is_start_position_verified": False,
158+
"is_end_position_verified": False,
159+
"vehicle_impact": "some-lanes-closed",
160+
"work_zone_type": "static",
161+
"lanes": [
162+
{"order": 1, "type": "shoulder", "status": "open"},
163+
{"order": 2, "type": "general", "status": "closed"},
164+
{"order": 3, "type": "general", "status": "closed"},
165+
{"order": 4, "type": "shoulder", "status": "open"},
166+
],
167+
},
168+
"geometry": {
169+
"type": "MultiPoint",
170+
"coordinates": [[-108.279106, 39.195663], [-108.218549, 39.302392]],
171+
},
172+
}
173+
],
174+
}

tests/data/standard_to_enhanced/icone_translator_data.py renamed to tests/data/standard_to_wzdx/icone_translator_data.py

File renamed without changes.

tests/data/standard_to_enhanced/navjoy_translator_data.py renamed to tests/data/standard_to_wzdx/navjoy_translator_data.py

File renamed without changes.

tests/data/standard_to_enhanced/planned_events_translator_data.py renamed to tests/data/standard_to_wzdx/planned_events_translator_data.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@
242242
"event_type": "restriction",
243243
"road_names": ["I-70E"],
244244
"direction": "westbound",
245-
"relationship": {},
246245
"description": "Between Exit 49: CO 65; Grand Mesa (5 miles east of the Palisade area) and US 6 (Debeque) from Mile Point 50 to Mile Point 60. Road closed expect delays due to bridge construction. Until May 1, 2022 at about 12:26PM MDT.",
247246
"update_date": "2021-10-29T18:35:01Z",
248247
},

0 commit comments

Comments
 (0)