Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Azaya89 committed Nov 25, 2024
1 parent a1baf25 commit e3f4815
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions hvplot/tests/testgeowithoutgv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'

0 comments on commit e3f4815

Please sign in to comment.