make sure PHP and Python reverse code does the same

The only allowable difference is precision of coordinates. Python uses
a precision of 7 digits where possible, which corresponds to the
precision of OSM data.

Also fixes some smaller bugs found by the BDD tests.
This commit is contained in:
Sarah Hoffmann
2023-03-26 12:22:34 +02:00
parent 300921a93e
commit 86b43dc605
20 changed files with 235 additions and 162 deletions

View File

@@ -378,6 +378,10 @@ def test_lookup_in_tiger(apiobj):
startnumber=1, endnumber=4, step=1,
postcode='34425',
geometry='LINESTRING(23 34, 23 35)')
apiobj.add_placex(place_id=12,
category=('highway', 'residential'),
osm_type='W', osm_id=6601223,
geometry='LINESTRING(23 34, 23 35)')
result = apiobj.api.lookup(napi.PlaceID(4924), napi.LookupDetails())
@@ -390,7 +394,7 @@ def test_lookup_in_tiger(apiobj):
assert result.place_id == 4924
assert result.parent_place_id == 12
assert result.linked_place_id is None
assert result.osm_object is None
assert result.osm_object == ('W', 6601223)
assert result.admin_level == 15
assert result.names is None

View File

@@ -58,9 +58,9 @@ def test_create_row_none(func):
@pytest.mark.parametrize('func', (nresults.create_from_osmline_row,
nresults.create_from_tiger_row))
def test_create_row_with_housenumber(func):
row = FakeRow(place_id = 2345, osm_id = 111, housenumber = 4,
address = None, postcode = '99900', country_code = 'xd',
centroid = FakeCentroid(0, 0))
row = FakeRow(place_id=2345, osm_type='W', osm_id=111, housenumber=4,
address=None, postcode='99900', country_code='xd',
centroid=FakeCentroid(0, 0))
res = func(row, DetailedResult)
@@ -72,7 +72,7 @@ def test_create_row_with_housenumber(func):
@pytest.mark.parametrize('func', (nresults.create_from_osmline_row,
nresults.create_from_tiger_row))
def test_create_row_without_housenumber(func):
row = FakeRow(place_id=2345, osm_id=111,
row = FakeRow(place_id=2345, osm_type='W', osm_id=111,
startnumber=1, endnumber=11, step=2,
address=None, postcode='99900', country_code='xd',
centroid=FakeCentroid(0, 0))