From 2c21cbb5e6394e0679c09850f66fd93cd63da97a Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 10 Jun 2019 18:22:11 +0200 Subject: [PATCH] update osm2pgsql (downgrading unnamed places) Also adds tests for updating unnamed places. --- osm2pgsql | 2 +- test/bdd/environment.py | 1 + test/bdd/osm2pgsql/update/simple.feature | 35 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/osm2pgsql b/osm2pgsql index 37967960..90e17f0e 160000 --- a/osm2pgsql +++ b/osm2pgsql @@ -1 +1 @@ -Subproject commit 37967960a82f6846681141b3d5cffaa03c184cb7 +Subproject commit 90e17f0e8c793487ca39cbf95501cd9c5daa33e2 diff --git a/test/bdd/environment.py b/test/bdd/environment.py index 02d09824..b12b6481 100644 --- a/test/bdd/environment.py +++ b/test/bdd/environment.py @@ -195,6 +195,7 @@ class NominatimEnvironment(object): proc = subprocess.Popen(cmd, cwd=self.build_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (outp, outerr) = proc.communicate() + outerr = outerr.decode('utf-8').replace('\\n', '\n') logger.debug("run_nominatim_script: %s\n%s\n%s" % (cmd, outp, outerr)) assert (proc.returncode == 0), "Script '%s' failed:\n%s\n%s\n" % (script, outp, outerr) diff --git a/test/bdd/osm2pgsql/update/simple.feature b/test/bdd/osm2pgsql/update/simple.feature index e8d96d44..072f83fa 100644 --- a/test/bdd/osm2pgsql/update/simple.feature +++ b/test/bdd/osm2pgsql/update/simple.feature @@ -24,3 +24,38 @@ Feature: Update of simple objects by osm2pgsql | object | class | type | name | | N1:tourism | tourism | hotel | 'name' : 'foo' | + Scenario: Downgrading a highway to one that is dropped without name + When loading osm data + """ + n100 x0 y0 + n101 x0.0001 y0.0001 + w1 Thighway=residential Nn100,n101 + """ + Then place contains + | object | + | W1:highway | + When updating osm data + """ + w1 Thighway=service Nn100,n101 + """ + Then place has no entry for W1 + + Scenario: Downgrading a highway when a second tag is present + When loading osm data + """ + n100 x0 y0 + n101 x0.0001 y0.0001 + w1 Thighway=residential,tourism=hotel Nn100,n101 + """ + Then place contains + | object | + | W1:highway | + | W1:tourism | + When updating osm data + """ + w1 Thighway=service,tourism=hotel Nn100,n101 + """ + Then place has no entry for W1:highway + And place contains + | object | + | W1:tourism | -- 2.39.5