diff --git a/tests/test_geocode.py b/tests/test_geocode.py index 3db04a8..e318a75 100644 --- a/tests/test_geocode.py +++ b/tests/test_geocode.py @@ -30,6 +30,7 @@ class TestGeocode(unittest.TestCase): def test_prepare_result(self): # Calls _prepare_result with sample results from the geocoder call # loop + from geopandas.geocode import _prepare_geocode_result p0 = Point(12.3, -45.6) # Treat these as lat/lon p1 = Point(-23.4, 56.7) d = {'a': ('address0', p0.coords[0]), @@ -53,6 +54,7 @@ class TestGeocode(unittest.TestCase): self.assertAlmostEqual(coords[1], test[0]) def test_prepare_result_none(self): + from geopandas.geocode import _prepare_geocode_result p0 = Point(12.3, -45.6) # Treat these as lat/lon d = {'a': ('address0', p0.coords[0]), 'b': (None, None)} @@ -68,18 +70,22 @@ class TestGeocode(unittest.TestCase): self.assert_(pd.np.isnan(row['address'])) def test_bad_provider(self): + from geopandas.geocode import geocode with self.assertRaises(ValueError): geocode(['cambridge, ma'], 'badprovider') def test_googlev3(self): + from geopandas.geocode import geocode g = geocode(self.locations, provider='googlev3', timeout=2) self.assertIsInstance(g, gpd.GeoDataFrame) def test_openmapquest(self): + from geopandas.geocode import geocode g = geocode(self.locations, provider='openmapquest', timeout=2) self.assertIsInstance(g, gpd.GeoDataFrame) @unittest.skip('Nominatim server is unreliable for tests.') def test_nominatim(self): + from geopandas.geocode import geocode g = geocode(self.locations, provider='nominatim', timeout=2) self.assertIsInstance(g, gpd.GeoDataFrame)