# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
-Tests for lookup API call.
+Tests for details API call.
"""
import datetime as dt
indexed_date=import_date,
geometry='LINESTRING(23 34, 23.1 34, 23.1 34.1, 23 34)')
- result = apiobj.api.details(idobj, napi.LookupDetails())
+ result = apiobj.api.details(idobj)
assert result is not None
indexed_date=import_date,
geometry='LINESTRING(23 34, 23.1 34, 23.1 34.1, 23 34)')
- result = apiobj.api.details(napi.PlaceID(332), napi.LookupDetails())
+ result = apiobj.api.details(napi.PlaceID(332))
assert result is not None
apiobj.add_placex(place_id=332,
geometry='LINESTRING(23 34, 23.1 34)')
- result = apiobj.api.details(napi.PlaceID(332),
- napi.LookupDetails(geometry_output=napi.GeometryFormat.GEOJSON))
+ result = apiobj.api.details(napi.PlaceID(332), geometry_output=napi.GeometryFormat.GEOJSON)
assert result.geometry == {'geojson': '{"type":"LineString","coordinates":[[23,34],[23.1,34]]}'}
country_code='pl',
rank_search=17, rank_address=16)
- result = apiobj.api.details(napi.PlaceID(332),
- napi.LookupDetails(address_details=True))
+ result = apiobj.api.details(napi.PlaceID(332), address_details=True)
assert result.address_rows == [
napi.AddressLine(place_id=332, osm_object=('W', 4),
category=('highway', 'residential'),
names={'name': 'Street'}, extratags={},
admin_level=15, fromarea=True, isaddress=True,
- rank_address=26, distance=0.0),
+ rank_address=26, distance=0.0,
+ local_name='Street'),
napi.AddressLine(place_id=1000, osm_object=('N', 3333),
category=('place', 'suburb'),
names={'name': 'Smallplace'}, extratags={},
admin_level=13, fromarea=False, isaddress=True,
- rank_address=23, distance=0.0034),
+ rank_address=23, distance=0.0034,
+ local_name='Smallplace'),
napi.AddressLine(place_id=1001, osm_object=('N', 3334),
category=('place', 'city'),
names={'name': 'Bigplace'}, extratags={},
admin_level=15, fromarea=True, isaddress=True,
- rank_address=16, distance=0.0),
+ rank_address=16, distance=0.0,
+ local_name='Bigplace'),
napi.AddressLine(place_id=None, osm_object=None,
category=('place', 'country_code'),
names={'ref': 'pl'}, extratags={},
country_code='pl', linked_place_id=45,
rank_search=27, rank_address=26)
- result = apiobj.api.details(napi.PlaceID(332),
- napi.LookupDetails(linked_places=True))
+ result = apiobj.api.details(napi.PlaceID(332), linked_places=True)
assert result.linked_rows == []
country_code='pl', linked_place_id=332,
rank_search=27, rank_address=26)
- result = apiobj.api.details(napi.PlaceID(332),
- napi.LookupDetails(linked_places=True))
+ result = apiobj.api.details(napi.PlaceID(332), linked_places=True)
assert result.linked_rows == [
napi.AddressLine(place_id=1001, osm_object=('W', 5),
country_code='pl', parent_place_id=45,
rank_search=27, rank_address=26)
- result = apiobj.api.details(napi.PlaceID(332),
- napi.LookupDetails(parented_places=True))
+ result = apiobj.api.details(napi.PlaceID(332), parented_places=True)
assert result.parented_rows == []
country_code='pl', parent_place_id=332,
rank_search=27, rank_address=26)
- result = apiobj.api.details(napi.PlaceID(332),
- napi.LookupDetails(parented_places=True))
+ result = apiobj.api.details(napi.PlaceID(332), parented_places=True)
assert result.parented_rows == [
napi.AddressLine(place_id=1001, osm_object=('N', 5),
indexed_date=import_date,
geometry='LINESTRING(23 34, 23 35)')
- result = apiobj.api.details(idobj, napi.LookupDetails())
+ result = apiobj.api.details(idobj)
assert result is not None
startnumber=11, endnumber=20, step=1)
for i in range(1, 6):
- result = apiobj.api.details(napi.OsmID('W', 9, str(i)), napi.LookupDetails())
+ result = apiobj.api.details(napi.OsmID('W', 9, str(i)))
assert result.place_id == 1000
for i in range(7, 11):
- result = apiobj.api.details(napi.OsmID('W', 9, str(i)), napi.LookupDetails())
+ result = apiobj.api.details(napi.OsmID('W', 9, str(i)))
assert result.place_id == 1001
for i in range(12, 22):
- result = apiobj.api.details(napi.OsmID('W', 9, str(i)), napi.LookupDetails())
+ result = apiobj.api.details(napi.OsmID('W', 9, str(i)))
assert result.place_id == 1002
country_code='pl',
rank_search=17, rank_address=16)
- result = apiobj.api.details(napi.PlaceID(9000),
- napi.LookupDetails(address_details=True))
+ result = apiobj.api.details(napi.PlaceID(9000), address_details=True)
assert result.address_rows == [
napi.AddressLine(place_id=None, osm_object=None,
category=('place', 'house_number'),
names={'ref': '2'}, extratags={},
admin_level=None, fromarea=True, isaddress=True,
- rank_address=28, distance=0.0),
+ rank_address=28, distance=0.0,
+ local_name='2'),
napi.AddressLine(place_id=332, osm_object=('W', 4),
category=('highway', 'residential'),
names={'name': 'Street'}, extratags={},
admin_level=15, fromarea=True, isaddress=True,
- rank_address=26, distance=0.0),
+ rank_address=26, distance=0.0,
+ local_name='Street'),
napi.AddressLine(place_id=1000, osm_object=('N', 3333),
category=('place', 'suburb'),
names={'name': 'Smallplace'}, extratags={},
admin_level=13, fromarea=False, isaddress=True,
- rank_address=23, distance=0.0034),
+ rank_address=23, distance=0.0034,
+ local_name='Smallplace'),
napi.AddressLine(place_id=1001, osm_object=('N', 3334),
category=('place', 'city'),
names={'name': 'Bigplace'}, extratags={},
admin_level=15, fromarea=True, isaddress=True,
- rank_address=16, distance=0.0),
+ rank_address=16, distance=0.0,
+ local_name='Bigplace'),
napi.AddressLine(place_id=None, osm_object=None,
category=('place', 'country_code'),
names={'ref': 'pl'}, extratags={},
osm_type='W', osm_id=6601223,
geometry='LINESTRING(23 34, 23 35)')
- result = apiobj.api.details(napi.PlaceID(4924), napi.LookupDetails())
+ result = apiobj.api.details(napi.PlaceID(4924))
assert result is not None
country_code='us',
rank_search=17, rank_address=16)
- result = apiobj.api.details(napi.PlaceID(9000),
- napi.LookupDetails(address_details=True))
+ result = apiobj.api.details(napi.PlaceID(9000), address_details=True)
assert result.address_rows == [
napi.AddressLine(place_id=None, osm_object=None,
category=('place', 'house_number'),
names={'ref': '2'}, extratags={},
admin_level=None, fromarea=True, isaddress=True,
- rank_address=28, distance=0.0),
+ rank_address=28, distance=0.0,
+ local_name='2'),
napi.AddressLine(place_id=332, osm_object=('W', 4),
category=('highway', 'residential'),
names={'name': 'Street'}, extratags={},
admin_level=15, fromarea=True, isaddress=True,
- rank_address=26, distance=0.0),
+ rank_address=26, distance=0.0,
+ local_name='Street'),
napi.AddressLine(place_id=1000, osm_object=('N', 3333),
category=('place', 'suburb'),
names={'name': 'Smallplace'}, extratags={},
admin_level=13, fromarea=False, isaddress=True,
- rank_address=23, distance=0.0034),
+ rank_address=23, distance=0.0034,
+ local_name='Smallplace'),
napi.AddressLine(place_id=1001, osm_object=('N', 3334),
category=('place', 'city'),
names={'name': 'Bigplace'}, extratags={},
admin_level=15, fromarea=True, isaddress=True,
- rank_address=16, distance=0.0),
+ rank_address=16, distance=0.0,
+ local_name='Bigplace'),
napi.AddressLine(place_id=None, osm_object=None,
category=('place', 'country_code'),
names={'ref': 'us'}, extratags={},
indexed_date=import_date,
geometry='POINT(-9.45 5.6)')
- result = apiobj.api.details(napi.PlaceID(554), napi.LookupDetails())
+ result = apiobj.api.details(napi.PlaceID(554))
assert result is not None
country_code='gb',
rank_search=17, rank_address=16)
- result = apiobj.api.details(napi.PlaceID(9000),
- napi.LookupDetails(address_details=True))
+ result = apiobj.api.details(napi.PlaceID(9000), address_details=True)
assert result.address_rows == [
napi.AddressLine(place_id=332, osm_object=('N', 3333),
category=('place', 'suburb'),
names={'name': 'Smallplace'}, extratags={},
admin_level=13, fromarea=True, isaddress=True,
- rank_address=23, distance=0.0),
+ rank_address=23, distance=0.0,
+ local_name='Smallplace'),
napi.AddressLine(place_id=1001, osm_object=('N', 3334),
category=('place', 'city'),
names={'name': 'Bigplace'}, extratags={},
admin_level=15, fromarea=True, isaddress=True,
- rank_address=16, distance=0.0),
+ rank_address=16, distance=0.0,
+ local_name='Bigplace'),
napi.AddressLine(place_id=None, osm_object=None,
category=('place', 'postcode'),
names={'ref': '34 425'}, extratags={},
admin_level=None, fromarea=False, isaddress=True,
- rank_address=5, distance=0.0),
+ rank_address=5, distance=0.0,
+ local_name='34 425'),
napi.AddressLine(place_id=None, osm_object=None,
category=('place', 'country_code'),
names={'ref': 'gb'}, extratags={},
apiobj.add_placex(place_id=1, osm_type='N', osm_id=55,
class_='place', type='suburb')
- assert apiobj.api.details(objid, napi.LookupDetails()) is None
+ assert apiobj.api.details(objid) is None
@pytest.mark.parametrize('gtype', (napi.GeometryFormat.KML,
apiobj.add_placex(place_id=332)
with pytest.raises(ValueError):
- apiobj.api.details(napi.PlaceID(332),
- napi.LookupDetails(geometry_output=gtype))
+ apiobj.api.details(napi.PlaceID(332), geometry_output=gtype)