From e3f481506baf7ce64f28948d96eb87df480da95f Mon Sep 17 00:00:00 2001 From: Isaiah Akorita Date: Mon, 25 Nov 2024 16:23:51 +0100 Subject: [PATCH] added tests --- hvplot/tests/testgeowithoutgv.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hvplot/tests/testgeowithoutgv.py b/hvplot/tests/testgeowithoutgv.py index 7ad0bf3ee..21fd7a8df 100644 --- a/hvplot/tests/testgeowithoutgv.py +++ b/hvplot/tests/testgeowithoutgv.py @@ -7,6 +7,9 @@ import numpy as np import pandas as pd import pytest +import spatialpandas as spd + +from hvplot.util import is_geodataframe try: import dask.dataframe as dd @@ -83,3 +86,20 @@ def test_plot_with_dask(self, simple_df): assert isinstance(plot.get(0), hv.Tiles) bk_plot = bk_renderer.get_plot(plot) assert bk_plot.projection == 'mercator' + + @pytest.mark.skipif(spd is None, reason='spatialpandas not installed') + def test_plot_without_crs(self): + square = spd.geometry.Polygon([(0.0, 0), (0, 1), (1, 1), (1, 0)]) + sdf = spd.GeoDataFrame({'geometry': spd.GeoSeries([square, square]), 'name': ['A', 'B']}) + plot = sdf.hvplot.polygons(tiles=True) + + if hasattr(sdf, 'crs'): + del sdf.crs + + assert len(plot) == 2 + assert is_geodataframe(sdf) + assert not hasattr(plot, 'crs') + assert isinstance(plot.get(0), hv.Tiles) + assert isinstance(plot.get(1), hv.Polygons) + bk_plot = bk_renderer.get_plot(plot) + assert bk_plot.projection == 'mercator'