Fix encoding of missing fields
This commit is contained in:
parent
d00a48f16e
commit
6da70fd8ea
@ -93,7 +93,7 @@ class HereMapsBulkGeocoder(HereMapsGeocoder, StreetPointBulkGeocoder):
|
|||||||
for search in searches:
|
for search in searches:
|
||||||
fields = [search.address, search.city, search.state]
|
fields = [search.address, search.city, search.state]
|
||||||
search_text = ', '.join(filter(None, fields))
|
search_text = ', '.join(filter(None, fields))
|
||||||
row = [s.encode("utf-8")
|
row = [s.encode("utf-8") if s else ''
|
||||||
for s in [str(search.id), search_text, search.country]]
|
for s in [str(search.id), search_text, search.country]]
|
||||||
writer.writerow(row)
|
writer.writerow(row)
|
||||||
|
|
||||||
|
@ -233,6 +233,13 @@ class TestBulkStreetFunctions(TestStreetFunctionsSetUp):
|
|||||||
response = self._run_authenticated(query)
|
response = self._run_authenticated(query)
|
||||||
assert_equal(n - 1, len(response['rows']))
|
assert_equal(n - 1, len(response['rows']))
|
||||||
|
|
||||||
|
def test_missing_components_on_private_function(self):
|
||||||
|
query = "SELECT _cdb_bulk_geocode_street_point(" \
|
||||||
|
" '[{\"id\": \"1\", \"address\": \"Amphitheatre Parkway 22\"}]' " \
|
||||||
|
")"
|
||||||
|
response = self._run_authenticated(query)
|
||||||
|
assert_equal(1, len(response['rows']))
|
||||||
|
|
||||||
def _run_authenticated(self, query):
|
def _run_authenticated(self, query):
|
||||||
authenticated_query = "{}&api_key={}".format(query,
|
authenticated_query = "{}&api_key={}".format(query,
|
||||||
self.env_variables[
|
self.env_variables[
|
||||||
|
Loading…
Reference in New Issue
Block a user