From c13d29e4c2b3a5ccc0ad44075b67ff5aca75c11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Ignacio=20S=C3=A1nchez=20Lara?= Date: Tue, 26 Jun 2018 16:52:41 +0200 Subject: [PATCH] test_free_text_geocoding --- test/integration/test_street_functions.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/integration/test_street_functions.py b/test/integration/test_street_functions.py index 3694468..9214c2f 100644 --- a/test/integration/test_street_functions.py +++ b/test/integration/test_street_functions.py @@ -106,7 +106,6 @@ class TestBulkStreetFunctions(TestStreetFunctionsSetUp): self._assert_x_y(row_by_cartodb_id[2], -122.0885504, 37.4238657) self._assert_x_y(row_by_cartodb_id[3], -122.0876674, 37.4235729) - def test_city_column_geocoding(self): query = "select *, st_x(the_geom), st_y(the_geom) " \ "FROM cdb_dataservices_client.cdb_bulk_geocode_street_point( " \ @@ -116,7 +115,6 @@ class TestBulkStreetFunctions(TestStreetFunctionsSetUp): "]''::jsonb) as (cartodb_id integer, city text)', " \ "'city')" response = self._run_authenticated(query) - # from nose.tools import set_trace; set_trace() assert_equal(response['total_rows'], 2) @@ -124,6 +122,22 @@ class TestBulkStreetFunctions(TestStreetFunctionsSetUp): self._assert_x_y(row_by_cartodb_id[1], -4.7245321, 41.652251) self._assert_x_y(row_by_cartodb_id[2], -3.7037902, 40.4167754) + def test_free_text_geocoding(self): + query = "select *, st_x(the_geom), st_y(the_geom) " \ + "FROM cdb_dataservices_client.cdb_bulk_geocode_street_point( " \ + "'select * from (" \ + "select 1 as cartodb_id, ''W 26th Street'' as address, " \ + "null as city , null as state , null as country" \ + ")_x', " \ + "'''LogroƱo, La Rioja, Spain''')" + response = self._run_authenticated(query) + # from nose.tools import set_trace; set_trace() + + assert_equal(response['total_rows'], 1) + + row_by_cartodb_id = self._row_by_cartodb_id(response) + self._assert_x_y(row_by_cartodb_id[1], -2.4449852, 42.4627195) + def _run_authenticated(self, query): authenticated_query = "{}&api_key={}".format(query,