mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 05:14:07 +00:00
add tests for different scripts
This commit is contained in:
@@ -37,3 +37,24 @@ Feature: Import and search of names
|
|||||||
Then placex contains
|
Then placex contains
|
||||||
| object | country_code | name | name+name:fi | name+name:de |
|
| object | country_code | name | name+name:fi | name+name:de |
|
||||||
| N1 | de | german | finnish | local |
|
| N1 | de | german | finnish | local |
|
||||||
|
|
||||||
|
Scenario Outline: Names in any script can be found
|
||||||
|
Given the places
|
||||||
|
| osm | class | type | name |
|
||||||
|
| N1 | place | hamlet | <name> |
|
||||||
|
When importing
|
||||||
|
And sending search query "<name>"
|
||||||
|
Then results contain
|
||||||
|
| osm |
|
||||||
|
| N1 |
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
| name |
|
||||||
|
| Berlin |
|
||||||
|
| 北京 |
|
||||||
|
| Вологда |
|
||||||
|
| Αθήνα |
|
||||||
|
| القاهرة |
|
||||||
|
| រាជធានីភ្នំពេញ |
|
||||||
|
| 東京都 |
|
||||||
|
| ပုဗ္ဗသီရိ |
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import xml.etree.ElementTree as ET
|
|||||||
|
|
||||||
from check_functions import Almost
|
from check_functions import Almost
|
||||||
|
|
||||||
|
OSM_TYPE = {'N' : 'node', 'W' : 'way', 'R' : 'relation'}
|
||||||
|
|
||||||
def _geojson_result_to_json_result(geojson_result):
|
def _geojson_result_to_json_result(geojson_result):
|
||||||
result = geojson_result['properties']
|
result = geojson_result['properties']
|
||||||
result['geojson'] = geojson_result['geometry']
|
result['geojson'] = geojson_result['geometry']
|
||||||
@@ -131,7 +133,11 @@ class GenericResponse:
|
|||||||
if name == 'ID':
|
if name == 'ID':
|
||||||
pass
|
pass
|
||||||
elif name == 'osm':
|
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:])
|
self.assert_field(i, 'osm_id', value[1:])
|
||||||
elif name == 'centroid':
|
elif name == 'centroid':
|
||||||
lon, lat = value.split(' ')
|
lon, lat = value.split(' ')
|
||||||
|
|||||||
Reference in New Issue
Block a user