]> git.openstreetmap.org Git - nominatim.git/commitdiff
add osm2pgsql broken data tests
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 28 Nov 2016 22:27:40 +0000 (23:27 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 30 Dec 2016 21:58:58 +0000 (22:58 +0100)
test/bdd/osm2pgsql/import/broken.feature [new file with mode: 0644]
test/bdd/steps/db_ops.py

diff --git a/test/bdd/osm2pgsql/import/broken.feature b/test/bdd/osm2pgsql/import/broken.feature
new file mode 100644 (file)
index 0000000..aa8d8e3
--- /dev/null
@@ -0,0 +1,33 @@
+@DB
+Feature: Import of objects with broken geometries by osm2pgsql
+
+    Scenario: Import way with double nodes
+        When loading osm data
+          """
+          n100 x0 y0
+          n101 x0 y0.1
+          n102 x0.1 y0.2
+          w1 Thighway=primary Nn100,n101,n101,n102
+          """
+        Then place contains
+          | object | class   | type    | geometry |
+          | W1     | highway | primary | 0 0, 0 0.1, 0.1 0.2 |
+
+    @wip
+    Scenario: Import of ballon areas
+        When loading osm data
+          """
+          n1   x0 y0
+          n2   x0 y0.0001
+          n3   x0.00001 y0.0001
+          n4   x0.00001 y0
+          n5   x-0.00001 y0
+          w1 Thighway=unclassified Nn1,n2,n3,n4,n1,n5
+          w2 Thighway=unclassified Nn1,n2,n3,n4,n1
+          w3 Thighway=unclassified Nn1,n2,n3,n4,n3
+          """
+        Then place contains
+          | object | geometrytype |
+          | W1     | ST_LineString |
+          | W2     | ST_Polygon |
+          | W3     | ST_LineString |
index 77f279bf85fe86853281105a8acd4083aa7d311b..a3cafa016746c2c711a0d6448903aea1fd924bbd 100644 (file)
@@ -296,7 +296,8 @@ def check_placex_contents(context, exact):
     for row in context.table:
         nid = NominatimID(row['object'])
         where, params = nid.table_select()
-        cur.execute("""SELECT *, ST_AsText(geometry) as geomtxt
+        cur.execute("""SELECT *, ST_AsText(geometry) as geomtxt,
+                       ST_GeometryType(geometry) as geometrytype
                        FROM place where %s""" % where,
                     params)
         assert_less(0, cur.rowcount, "No rows found for " + row['object'])