X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/1924beeb20db05adbe04f493a3287811ec5b5701..e1af6a22d357de51c86ac73582beba2b4419227b:/test/python/api/test_api_lookup.py?ds=sidebyside diff --git a/test/python/api/test_api_lookup.py b/test/python/api/test_api_lookup.py index adba11ad..6939ddb9 100644 --- a/test/python/api/test_api_lookup.py +++ b/test/python/api/test_api_lookup.py @@ -58,7 +58,7 @@ def test_lookup_in_placex(apiobj, idobj): assert result.importance == pytest.approx(0.01) assert result.country_code == 'gb' - assert result.indexed_date == import_date + assert result.indexed_date == import_date.replace(tzinfo=dt.timezone.utc) assert result.address_rows is None assert result.linked_rows is None @@ -106,7 +106,7 @@ def test_lookup_in_placex_minimal_info(apiobj): assert result.importance is None assert result.country_code is None - assert result.indexed_date == import_date + assert result.indexed_date == import_date.replace(tzinfo=dt.timezone.utc) assert result.address_rows is None assert result.linked_rows is None @@ -290,7 +290,7 @@ def test_lookup_in_osmline(apiobj, idobj): assert result.importance is None assert result.country_code == 'gb' - assert result.indexed_date == import_date + assert result.indexed_date == import_date.replace(tzinfo=dt.timezone.utc) assert result.address_rows is None assert result.linked_rows is None @@ -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 @@ -506,7 +510,7 @@ def test_lookup_in_postcode(apiobj): assert result.importance is None assert result.country_code == 'gb' - assert result.indexed_date == import_date + assert result.indexed_date == import_date.replace(tzinfo=dt.timezone.utc) assert result.address_rows is None assert result.linked_rows is None @@ -559,6 +563,15 @@ def test_lookup_postcode_with_address_details(apiobj): rank_address=4, distance=0.0) ] +@pytest.mark.parametrize('objid', [napi.PlaceID(1736), + napi.OsmID('W', 55), + napi.OsmID('N', 55, 'amenity')]) +def test_lookup_missing_object(apiobj, objid): + apiobj.add_placex(place_id=1, osm_type='N', osm_id=55, + class_='place', type='suburb') + + assert apiobj.api.lookup(objid, napi.LookupDetails()) is None + @pytest.mark.parametrize('gtype', (napi.GeometryFormat.KML, napi.GeometryFormat.SVG,