From 351ef71eb3553605da4f9edd300a8e899ccab7da Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Sun, 22 May 2022 09:45:37 +0200 Subject: [PATCH] TST: update is_closed test for shapely 1.8.2 (#2437) --- geopandas/_compat.py | 1 + geopandas/tests/test_array.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/geopandas/_compat.py b/geopandas/_compat.py index 8a68cdb..dd67212 100644 --- a/geopandas/_compat.py +++ b/geopandas/_compat.py @@ -28,6 +28,7 @@ PANDAS_GE_14 = Version(pd.__version__) >= Version("1.4.0rc0") SHAPELY_GE_18 = Version(shapely.__version__) >= Version("1.8") +SHAPELY_GE_182 = Version(shapely.__version__) >= Version("1.8.2") SHAPELY_GE_20 = Version(shapely.__version__) >= Version("2.0") GEOS_GE_390 = shapely.geos.geos_version >= (3, 9, 0) diff --git a/geopandas/tests/test_array.py b/geopandas/tests/test_array.py index bdba171..00750ec 100644 --- a/geopandas/tests/test_array.py +++ b/geopandas/tests/test_array.py @@ -467,8 +467,18 @@ def test_unary_predicates(attr): # empty Linearring.is_ring gives False with Shapely < 2.0 if compat.USE_PYGEOS and not compat.SHAPELY_GE_20: expected[-2] = True + elif ( + attr == "is_closed" + and compat.USE_PYGEOS + and compat.SHAPELY_GE_182 + and not compat.SHAPELY_GE_20 + ): + # In shapely 1.8.2, is_closed was changed to return always True for + # Polygon/MultiPolygon, while PyGEOS returns always False + expected = [False] * len(vals) else: expected = [getattr(t, attr) if t is not None else na_value for t in vals] + assert result.tolist() == expected