]> git.openstreetmap.org Git - nominatim.git/commitdiff
add tests for different scripts
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 26 Apr 2021 21:01:06 +0000 (23:01 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 26 Apr 2021 21:01:06 +0000 (23:01 +0200)
test/bdd/db/import/naming.feature
test/bdd/steps/http_responses.py

index f3019e2a52fe9e6e03b65e190443da5633e5a51a..bb29d2a314a46f7f917e298c4cf37fa311eb340c 100644 (file)
@@ -37,3 +37,24 @@ Feature: Import and search of names
         Then placex contains
           | object | country_code | name   | name+name:fi | name+name:de |
           | 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 |
+        | 北京 |
+        | Вологда |
+        | Αθήνα |
+        | القاهرة |
+        | រាជធានីភ្នំពេញ |
+        | 東京都 |
+        | ပုဗ္ဗသီရိ |
index beafcd9e1ee16773294f8279d8dd26ce080a3d6e..247a397bd47b1ed7c7d5e886e4c95e1811759973 100644 (file)
@@ -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(' ')