From e20e43bc6d42f682d467ab033cca9a2945395e6c Mon Sep 17 00:00:00 2001 From: juanrmn Date: Tue, 23 Jun 2020 09:57:06 +0200 Subject: [PATCH] using None instead of empty geometries --- cartoframes/utils/geom_utils.py | 2 +- tests/unit/utils/test_geom_utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cartoframes/utils/geom_utils.py b/cartoframes/utils/geom_utils.py index 9dd38622a..6d67d8d59 100644 --- a/cartoframes/utils/geom_utils.py +++ b/cartoframes/utils/geom_utils.py @@ -186,7 +186,7 @@ def decode_geometry_item(geom, enc_type): ENC_EWKT: lambda: _load_ewkt(geom) }.get(enc_type) return func() if func else geom - return shapely.geometry.base.BaseGeometry() + return None def _load_wkb(geom): diff --git a/tests/unit/utils/test_geom_utils.py b/tests/unit/utils/test_geom_utils.py index e9028570c..9f0d3734c 100644 --- a/tests/unit/utils/test_geom_utils.py +++ b/tests/unit/utils/test_geom_utils.py @@ -4,7 +4,7 @@ import geopandas as gpd from shapely.geos import lgeos -from shapely.geometry import Point, base +from shapely.geometry import Point from cartoframes.utils.geom_utils import (ENC_EWKT, ENC_SHAPELY, ENC_WKB, ENC_WKB_BHEX, ENC_WKB_HEX, ENC_WKT, @@ -44,7 +44,7 @@ def test_decode_geometry_empty(self): def test_decode_geometry_none(self): geom_none = gpd.GeoSeries([None, None]) - expected_decoded_geom = gpd.GeoSeries([base.BaseGeometry(), base.BaseGeometry()]) + expected_decoded_geom = gpd.GeoSeries([None, None]) decoded_geom = decode_geometry(geom_none) assert str(decoded_geom) == str(expected_decoded_geom)