TST BUG: Protect individual geopy dependent imports

This commit is contained in:
Kelsey Jordahl
2014-07-11 09:31:20 -05:00
parent d8c368d52c
commit 19ef25b9c2
+6
View File
@@ -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)