Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_to_geopandas(products):
gdf = SentinelAPI.to_geodataframe(products)
assert type(gdf).__name__ == "GeoDataFrame"
print(gdf.unary_union.area)
assert gdf.unary_union.area == pytest.approx(89.6, abs=0.1)
assert len(gdf) == len(products)
assert gdf.crs == {"init": "epsg:4326"}
def test_to_geopandas(products):
gdf = SentinelAPI.to_geodataframe(products)
assert type(gdf).__name__ == 'GeoDataFrame'
print(gdf.unary_union.area)
assert gdf.unary_union.area == pytest.approx(89.6, abs=0.1)
assert len(gdf) == len(products)
assert gdf.crs == {'init': 'epsg:4326'}
def test_missing_dependency_geodataframe(monkeypatch):
with pytest.raises(ImportError):
monkeypatch.setitem(sys.modules, "geopandas", None)
SentinelAPI.to_geodataframe({"test": "tst"})
def test_to_geopandas_empty(products):
gdf = SentinelAPI.to_geodataframe({})
assert type(gdf).__name__ == 'GeoDataFrame'
assert len(gdf) == 0
def test_to_geopandas_empty():
gdf = SentinelAPI.to_geodataframe({})
assert type(gdf).__name__ == "GeoDataFrame"
assert len(gdf) == 0