Dont raise exception when empty params passed to HERE geocoder
This commit is contained in:
@@ -70,7 +70,7 @@ class HereMapsGeocoder(Traceable):
|
|||||||
if value:
|
if value:
|
||||||
params[key] = value
|
params[key] = value
|
||||||
if not params:
|
if not params:
|
||||||
raise NoGeocodingParams()
|
return []
|
||||||
return self._execute_geocode(params)
|
return self._execute_geocode(params)
|
||||||
|
|
||||||
def _execute_geocode(self, params):
|
def _execute_geocode(self, params):
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ class HereMapsGeocoderTestCase(unittest.TestCase):
|
|||||||
def test_geocode_address_with_no_params(self, req_mock):
|
def test_geocode_address_with_no_params(self, req_mock):
|
||||||
req_mock.register_uri('GET', HereMapsGeocoder.PRODUCTION_GEOCODE_JSON_URL,
|
req_mock.register_uri('GET', HereMapsGeocoder.PRODUCTION_GEOCODE_JSON_URL,
|
||||||
text=self.GOOD_RESPONSE)
|
text=self.GOOD_RESPONSE)
|
||||||
with self.assertRaises(NoGeocodingParams):
|
result = self.geocoder.geocode()
|
||||||
self.geocoder.geocode()
|
self.assertEqual(result, [])
|
||||||
|
|
||||||
def test_geocode_address_empty_response(self, req_mock):
|
def test_geocode_address_empty_response(self, req_mock):
|
||||||
req_mock.register_uri('GET', HereMapsGeocoder.PRODUCTION_GEOCODE_JSON_URL,
|
req_mock.register_uri('GET', HereMapsGeocoder.PRODUCTION_GEOCODE_JSON_URL,
|
||||||
|
|||||||
Reference in New Issue
Block a user