make localisation of results explicit

Localisation was previously done as part of the formatting but might
also be useful on its own when working with the results directly.
This commit is contained in:
Sarah Hoffmann
2023-05-24 18:12:34 +02:00
parent dcfb228c9a
commit f335e78d1e
8 changed files with 58 additions and 51 deletions

View File

@@ -75,11 +75,14 @@ def test_search_details_minimal():
{'category': 'place',
'type': 'thing',
'admin_level': 15,
'names': {},
'localname': '',
'calculated_importance': pytest.approx(0.0000001),
'rank_address': 30,
'rank_search': 30,
'isarea': False,
'addresstags': {},
'extratags': {},
'centroid': {'type': 'Point', 'coordinates': [1.0, 2.0]},
'geometry': {'type': 'Point', 'coordinates': [1.0, 2.0]},
}
@@ -108,6 +111,7 @@ def test_search_details_full():
country_code='ll',
indexed_date = import_date
)
search.localize(napi.Locales())
result = api_impl.format_result(search, 'json', {})

View File

@@ -101,6 +101,7 @@ def test_format_reverse_with_address(fmt):
rank_address=10,
distance=0.0)
]))
reverse.localize(napi.Locales())
raw = api_impl.format_result(napi.ReverseResults([reverse]), fmt,
{'addressdetails': True})
@@ -164,6 +165,8 @@ def test_format_reverse_geocodejson_special_parts():
distance=0.0)
]))
reverse.localize(napi.Locales())
raw = api_impl.format_result(napi.ReverseResults([reverse]), 'geocodejson',
{'addressdetails': True})