Skip to content

Commit 137650e

Browse files
committed
make tests use new dynamic gazetteer style
Includes a test style that mimics previous behaviour, so that test results remain the same.
1 parent a7a9a42 commit 137650e

File tree

3 files changed

+236
-3
lines changed

3 files changed

+236
-3
lines changed

tests/gazetteer-test.style

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
[
2+
{
3+
"keys" : ["*source"],
4+
"values" : {
5+
"" : "skip"
6+
}
7+
},
8+
{
9+
"keys" : ["name:prefix", "name:suffix", "name:botanical", "wikidata",
10+
"*:wikidata"],
11+
"values" : {
12+
"" : "extra"
13+
}
14+
},
15+
{
16+
"keys" : ["ref", "int_ref", "nat_ref", "reg_ref", "loc_ref", "old_ref",
17+
"iata", "icao", "pcode", "pcode:*"],
18+
"values" : {
19+
"" : "ref"
20+
}
21+
},
22+
{
23+
"keys" : ["name", "name:*", "int_name", "int_name:*", "nat_name", "nat_name:*",
24+
"reg_name", "reg_name:*", "loc_name", "loc_name:*",
25+
"old_name", "old_name:*", "alt_name", "alt_name:*", "alt_name_*",
26+
"official_name", "official_name:*", "place_name", "place_name:*",
27+
"short_name", "short_name:*", "brand"],
28+
"values" : {
29+
"" : "name"
30+
}
31+
},
32+
{
33+
"keys" : ["addr:housename"],
34+
"values" : {
35+
"" : "name,house"
36+
}
37+
},
38+
{
39+
"keys" : ["emergency"],
40+
"values" : {
41+
"fire_hydrant" : "skip",
42+
"yes" : "skip",
43+
"no" : "skip",
44+
"" : "main"
45+
}
46+
},
47+
{
48+
"keys" : ["historic", "military"],
49+
"values" : {
50+
"no" : "skip",
51+
"yes" : "skip",
52+
"" : "main"
53+
}
54+
},
55+
{
56+
"keys" : ["natural"],
57+
"values" : {
58+
"yes" : "skip",
59+
"no" : "skip",
60+
"coastline" : "skip",
61+
"" : "main,with_name"
62+
}
63+
},
64+
{
65+
"keys" : ["landuse"],
66+
"values" : {
67+
"cemetry" : "main,with_name",
68+
"" : "main,fallback,with_name"
69+
}
70+
},
71+
{
72+
"keys" : ["highway"],
73+
"values" : {
74+
"no" : "skip",
75+
"turning_circle" : "skip",
76+
"mini_roundabout" : "skip",
77+
"noexit" : "skip",
78+
"crossing" : "skip",
79+
"traffic_signals" : "main,with_name",
80+
"service" : "main,with_name",
81+
"cycleway" : "main,with_name",
82+
"path" : "main,with_name",
83+
"footway" : "main,with_name",
84+
"steps" : "main,with_name",
85+
"bridleway" : "main,with_name",
86+
"track" : "main,with_name",
87+
"byway": "main,with_name",
88+
"motorway_link" : "main,with_name",
89+
"trunk_link" : "main,with_name",
90+
"primary_link" : "main,with_name",
91+
"secondary_link" : "main,with_name",
92+
"tertiary_link" : "main,with_name",
93+
"" : "main"
94+
}
95+
},
96+
{
97+
"keys" : ["railway"],
98+
"values" : {
99+
"level_crossing" : "skip",
100+
"no" : "skip",
101+
"" : "main,with_name"
102+
}
103+
},
104+
{
105+
"keys" : ["man_made"],
106+
"values" : {
107+
"survey_point" : "skip",
108+
"cutline" : "skip",
109+
"" : "main"
110+
}
111+
},
112+
{
113+
"keys" : ["aerialway"],
114+
"values" : {
115+
"pylon" : "skip",
116+
"no" : "skip",
117+
"" : "main"
118+
}
119+
},
120+
{
121+
"keys" : ["boundary"],
122+
"values" : {
123+
"" : "main,with_name"
124+
}
125+
},
126+
{
127+
"keys" : ["amenity"],
128+
"values" : {
129+
"restaurant" : "main,operator",
130+
"fuel" : "main,operator"
131+
}
132+
},
133+
{
134+
"keys" : ["aeroway", "amenity", "club", "craft", "leisure",
135+
"office", "mountain_pass"],
136+
"values" : {
137+
"no" : "skip",
138+
"" : "main"
139+
}
140+
},
141+
{
142+
"keys" : ["shop"],
143+
"values" : {
144+
"no" : "skip",
145+
"" : "main,operator"
146+
}
147+
},
148+
{
149+
"keys" : ["tourism"],
150+
"values" : {
151+
"yes" : "skip",
152+
"no" : "skip",
153+
"" : "main,operator"
154+
}
155+
},
156+
{
157+
"keys" : ["bridge", "tunnel"],
158+
"values" : {
159+
"" : "main,with_name_key"
160+
}
161+
},
162+
{
163+
"keys" : ["waterway"],
164+
"values" : {
165+
"riverbank" : "skip",
166+
"" : "main,with_name"
167+
}
168+
},
169+
{
170+
"keys" : ["place"],
171+
"values" : {
172+
"" : "main"
173+
}
174+
},
175+
{
176+
"keys" : ["junction"],
177+
"values" : {
178+
"" : "main,fallback,with_name"
179+
}
180+
},
181+
{
182+
"keys" : ["postal_code", "postcode", "addr:postcode",
183+
"tiger:zip_left", "tiger:zip_right"],
184+
"values" : {
185+
"" : "postcode"
186+
}
187+
},
188+
{
189+
"keys" : ["country_code", "ISO3166-1", "is_in:country_code", "is_in_country",
190+
"addr:country", "addr:country", "addr:country_code"],
191+
"values" : {
192+
"" : "country"
193+
}
194+
},
195+
{
196+
"keys" : ["addr:housenumber", "addr:conscriptionnumber", "addr:streetnumber"],
197+
"values" : {
198+
"" : "address,house"
199+
}
200+
},
201+
{
202+
"keys" : ["addr:*", "is_in:*", "tiger:county", "is_in"],
203+
"values" : {
204+
"" : "address"
205+
}
206+
},
207+
{
208+
"keys" : ["building"],
209+
"values" : {
210+
"no" : "skip",
211+
"" : "main,fallback,with_name"
212+
}
213+
},
214+
{
215+
"keys" : ["tracktype", "traffic_calming", "service", "cuisine", "capital",
216+
"dispensing", "religion", "denomination", "sport",
217+
"internet_access", "lanes", "surface", "smoothness", "width",
218+
"est_width", "incline", "opening_hours", "collection_times",
219+
"service_times", "disused", "wheelchair", "sac_scale",
220+
"trail_visibility", "mtb:scale", "mtb:description", "wood",
221+
"drive_through", "drive_in", "access", "vehicle", "bicyle",
222+
"foot", "goods", "hgv", "motor_vehicle", "motor_car", "oneway",
223+
"date_on", "date_off", "day_on", "day_off", "hour_on", "hour_off",
224+
"maxweight", "maxheight", "maxspeed", "fee", "toll", "charge",
225+
"population", "description", "image", "attribution", "fax",
226+
"email", "url", "website", "phone", "real_ale", "smoking",
227+
"food", "camera", "brewery", "locality", "wikipedia",
228+
"wikipedia:*", "access:*", "contact:*", "drink:*", "toll:*"],
229+
"values" : {
230+
"" : "extra"
231+
}
232+
}
233+
]

tests/regression-test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,12 @@ def updateGeneric(self, parameters, file):
370370
class BaseGazetteerTestCase(BaseTestCase):
371371

372372
def setUpGeneric(self, parameters, file):
373-
proc = subprocess.Popen([exe_path, "--slim", "-Ogazetteer", "-Sdefault.style", "-dosm2pgsql-test"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
373+
proc = subprocess.Popen([exe_path, "--slim", "-Ogazetteer", "-Stests/gazetteer-test.style", "-dosm2pgsql-test"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
374374
(outp, outerr) = proc.communicate()
375375
self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql --slim gazetteer options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
376376

377377
def updateGeneric(self, parameters, file):
378-
proc = subprocess.Popen([exe_path, "--slim", "-Ogazetteer", "--append", "-Sdefault.style", "-dosm2pgsql-test"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
378+
proc = subprocess.Popen([exe_path, "--slim", "-Ogazetteer", "--append", "-Stests/gazetteer-test.style", "-dosm2pgsql-test"] + parameters + [file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
379379
(outp, outerr) = proc.communicate()
380380
self.assertEqual (proc.returncode, 0, "Execution of osm2pgsql --slim --append gazetteer options: '%s' failed:\n%s\n%s\n" % (str(parameters), outp, outerr))
381381

tests/test-options-parse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void test_outputs()
9696
throw std::logic_error("Expected a pgsql output");
9797
}
9898

99-
const char* a2[] = {"osm2pgsql", "-O", "gazetteer", "--style", "default.style", "tests/liechtenstein-2013-08-03.osm.pbf"};
99+
const char* a2[] = {"osm2pgsql", "-O", "gazetteer", "--style", "tests/gazetteer-test.style", "tests/liechtenstein-2013-08-03.osm.pbf"};
100100
options = options_t(len(a2), const_cast<char **>(a2));
101101
mid = middle_t::create_middle(options.slim);
102102
outs = output_t::create_outputs(mid.get(), options);

0 commit comments

Comments
 (0)