def test_gpd_to_values_no_geom(): data = gpd.GeoDataFrame(pd.np.arange(3), columns=['param']) with pytest.warns(UserWarning, match="GeoDataFrame has no geometry to display."): for a, b in zip(json.loads(gpdvega.gpd_to_values(data)['values']), data.param.tolist()): assert a['param'] == b
def test_gpd_to_values(): data = _create_geojson() for a, b in zip( json.loads(gpdvega.gpd_to_values(geojson2gdp(data))['values']), data['features']): assert a['id'] == b['id'] assert a['prop'] == b['properties']['prop'] assert a['geometry'] == b['geometry']
def test_gpd_to_values_warnings(): data = geojson2gdp(_create_geojson()) with pytest.warns(UserWarning, match="Column name 'type'"): gpdvega.gpd_to_values(data.assign(type='type')) with pytest.warns(UserWarning, match="Column name 'id'"): gpdvega.gpd_to_values(data.assign(id='id')) with pytest.warns(UserWarning, match="Column name 'geometry'"): gpdvega.gpd_to_values( data.rename(columns={ 'geometry': 'g' }).set_geometry('g').assign(geometry='xxx'))
def test_gpd_to_values_pd(): data = pd.DataFrame(pd.np.arange(3), columns=['param']) assert gpdvega.gpd_to_values(data) == alt.to_values(data)