From 1feac2069bd2b559e4014fc6a1ca8046cd37b8a0 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 29 Mar 2023 20:49:34 +0200 Subject: [PATCH] add BDD tests for new layers parameter --- nominatim/api/v1/format_json.py | 1 - test/bdd/api/reverse/layers.feature | 88 +++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 test/bdd/api/reverse/layers.feature diff --git a/nominatim/api/v1/format_json.py b/nominatim/api/v1/format_json.py index 7387c89b..ef5f5280 100644 --- a/nominatim/api/v1/format_json.py +++ b/nominatim/api/v1/format_json.py @@ -28,7 +28,6 @@ def _write_typed_address(out: JsonWriter, address: Optional[napi.AddressLines], label = cl.get_label_tag(line.category, line.extratags, line.rank_address, country_code) if label not in parts: - print(label) parts[label] = line.local_name if line.names and 'ISO3166-2' in line.names and line.admin_level: parts[f"ISO3166-2-lvl{line.admin_level}"] = line.names['ISO3166-2'] diff --git a/test/bdd/api/reverse/layers.feature b/test/bdd/api/reverse/layers.feature new file mode 100644 index 00000000..d4c334a5 --- /dev/null +++ b/test/bdd/api/reverse/layers.feature @@ -0,0 +1,88 @@ +@APIDB +Feature: Layer parameter in reverse geocoding + Testing correct function of layer selection while reverse geocoding + + @v1-api-python-only + Scenario: POIs are selected by default + When sending v1/reverse at 47.14077,9.52414 + Then results contain + | category | type | + | tourism | viewpoint | + + + @v1-api-python-only + Scenario Outline: Same address level POI with different layers + When sending v1/reverse at 47.14077,9.52414 + | layer | + | | + Then results contain + | category | + | | + + + Examples: + | layer | category | + | address | highway | + | poi,address | tourism | + | address,poi | tourism | + | natural | waterway | + | address,natural | highway | + | natural,poi | tourism | + + + @v1-api-python-only + Scenario Outline: POIs are not selected without housenumber for address layer + When sending v1/reverse at 47.13816,9.52168 + | layer | + | | + Then results contain + | category | type | + | | | + + Examples: + | layer | category | type | + | address,poi | highway | bus_stop | + | address | amenity | parking | + + + @v1-api-python-only + Scenario: Between natural and low-zoom address prefer natural + When sending v1/reverse at 47.13636,9.52094 + | layer | zoom | + | natural,address | 15 | + Then results contain + | category | + | waterway | + + + @v1-api-python-only + Scenario Outline: Search for mountain peaks begins at level 12 + When sending v1/reverse at 47.08221,9.56769 + | layer | zoom | + | natural | | + Then results contain + | category | type | + | | | + + Examples: + | zoom | category | type | + | 12 | natural | peak | + | 13 | waterway | river | + + + @v1-api-python-only + Scenario Outline: Reverse serach with manmade layers + When sending v1/reverse at 32.46904,-86.44439 + | layer | + | | + Then results contain + | category | type | + | | | + + Examples: + | layer | category | type | + | manmade | leisure | park | + | address | highway | residential | + | poi | leisure | pitch | + | natural | waterway | stream | + | natural,manmade | leisure | park | -- 2.39.5