mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
add tests for different scripts
This commit is contained in:
@@ -8,6 +8,8 @@ import xml.etree.ElementTree as ET
|
||||
|
||||
from check_functions import Almost
|
||||
|
||||
OSM_TYPE = {'N' : 'node', 'W' : 'way', 'R' : 'relation'}
|
||||
|
||||
def _geojson_result_to_json_result(geojson_result):
|
||||
result = geojson_result['properties']
|
||||
result['geojson'] = geojson_result['geometry']
|
||||
@@ -131,7 +133,11 @@ class GenericResponse:
|
||||
if name == 'ID':
|
||||
pass
|
||||
elif name == 'osm':
|
||||
self.assert_field(i, 'osm_type', value[0])
|
||||
assert 'osm_type' in self.result[i], \
|
||||
"Result row {} has no field 'osm_type'.\nFull row: {}"\
|
||||
.format(i, json.dumps(self.result[i], indent=4))
|
||||
assert self.result[i]['osm_type'] in (OSM_TYPE[value[0]], value[0]), \
|
||||
BadRowValueAssert(self, i, 'osm_type', value)
|
||||
self.assert_field(i, 'osm_id', value[1:])
|
||||
elif name == 'centroid':
|
||||
lon, lat = value.split(' ')
|
||||
|
||||
Reference in New Issue
Block a user