Repository: mapbox/mapbox-sdk-py
Pull request #139 (2016-10-28 18:21:42)

add poi.landmark type, adjust tests


Patch:
diff --git a/docs/geocoding.md b/docs/geocoding.md
index 4c49b1a..b4dc2c5 100644
--- a/docs/geocoding.md
+++ b/docs/geocoding.md
@@ -134,7 +134,7 @@ Place results may be limited to those falling within a given bounding box.
 ```python
 
 >>> response = geocoder.forward(
-...     "washington", bbox=[-78.338320,38.520792,-77.935454,38.864909])
+...     "washington", bbox=[-78.338320,38.520792,-77.935454,38.864909], types=('place',))
 >>> response.status_code
 200
 >>> first = response.geojson()['features'][0]
diff --git a/mapbox/services/geocoding.py b/mapbox/services/geocoding.py
index 8989bbc..bafc48d 100644
--- a/mapbox/services/geocoding.py
+++ b/mapbox/services/geocoding.py
@@ -120,6 +120,7 @@ class Geocoder(Service):
             'country': "Sovereign states and other political entities. Examples: United States, France, China, Russia.",
             'place': "City, town, village or other municipality relevant to a country's address or postal system. Examples: Cleveland, Saratoga Springs, Berlin, Paris.",
             'neighborhood': "A smaller area within a place, often without formal boundaries. Examples: Montparnasse, Downtown, Haight-Ashbury.",
-            'poi': "Places of interest including commercial venues, major landmarks, parks, and other features. Examples: Yosemite National Park, Lake Superior.",
+            'poi': "Places of interest including commercial venues, major landmarks, parks, and other features. Examples: Subway Restaurant, Yosemite National Park, Statue of Liberty.",
+            'poi.landmark': "Places of interest that are particularly notable or long-lived like parks, places of worship and museums. A strict subset of the poi place type. Examples: Yosemite National Park, Statue of Liberty.",
             'postcode': "Postal code, varies by a country's postal system. Examples: 20009, CR0 3RL.",
             'region': "First order administrative divisions within a country, usually provinces or states. Examples: California, Ontario, Essonne."}


Test patch:
diff --git a/tests/test_geocoder.py b/tests/test_geocoder.py
index 5ecc3da..4919d09 100644
--- a/tests/test_geocoder.py
+++ b/tests/test_geocoder.py
@@ -104,7 +104,8 @@ def test_geocoder_place_types():
         ('country', "Sovereign states and other political entities. Examples: United States, France, China, Russia."),
         ('neighborhood', 'A smaller area within a place, often without formal boundaries. Examples: Montparnasse, Downtown, Haight-Ashbury.'),
         ('place', "City, town, village or other municipality relevant to a country's address or postal system. Examples: Cleveland, Saratoga Springs, Berlin, Paris."),
-        ('poi', "Places of interest including commercial venues, major landmarks, parks, and other features. Examples: Yosemite National Park, Lake Superior."),
+        ('poi', "Places of interest including commercial venues, major landmarks, parks, and other features. Examples: Subway Restaurant, Yosemite National Park, Statue of Liberty."),
+        ('poi.landmark', "Places of interest that are particularly notable or long-lived like parks, places of worship and museums. A strict subset of the poi place type. Examples: Yosemite National Park, Statue of Liberty."),
         ('postcode', "Postal code, varies by a country's postal system. Examples: 20009, CR0 3RL."),
         ('region', "First order administrative divisions within a country, usually provinces or states. Examples: California, Ontario, Essonne.")]
 
@@ -139,7 +140,7 @@ def test_geocoder_forward_types():
 
     responses.add(
         responses.GET,
-        'https://api.mapbox.com/geocoding/v5/mapbox.places/1600%20pennsylvania%20ave%20nw.json?types=address,country,place,poi,postcode,region&access_token=pk.test',
+        'https://api.mapbox.com/geocoding/v5/mapbox.places/1600%20pennsylvania%20ave%20nw.json?types=address,country,place,poi.landmark,postcode,region&access_token=pk.test',
         match_querystring=True,
         body='{"query": ["1600", "pennsylvania", "ave", "nw"]}', status=200,
         content_type='application/json')
@@ -147,7 +148,7 @@ def test_geocoder_forward_types():
     response = mapbox.Geocoder(
         access_token='pk.test').forward(
             '1600 pennsylvania ave nw',
-            types=('address', 'country', 'place', 'poi', 'postcode', 'region'))
+            types=('address', 'country', 'place', 'poi.landmark', 'postcode', 'region'))
     assert response.status_code == 200
     assert response.json()['query'] == ["1600", "pennsylvania", "ave", "nw"]
 
@@ -161,7 +162,7 @@ def test_geocoder_reverse_types():
 
     responses.add(
         responses.GET,
-        'https://api.mapbox.com/geocoding/v5/mapbox.places/{0},{1}.json?types=address,country,place,poi,postcode,region&access_token=pk.test'.format(lon, lat),
+        'https://api.mapbox.com/geocoding/v5/mapbox.places/{0},{1}.json?types=address,country,place,poi.landmark,postcode,region&access_token=pk.test'.format(lon, lat),
         match_querystring=True,
         body=body,
         status=200,
@@ -170,7 +171,7 @@ def test_geocoder_reverse_types():
     response = mapbox.Geocoder(
         access_token='pk.test').reverse(
             lon=lon, lat=lat,
-            types=('address', 'country', 'place', 'poi', 'postcode', 'region'))
+            types=('address', 'country', 'place', 'poi.landmark', 'postcode', 'region'))
     assert response.status_code == 200
     assert response.json()['query'] == [lon, lat]