Skip to content

Commit 273f76a

Browse files
committed
updated tests to handle pandas-dev/pandas#49677
1 parent 3bfd13f commit 273f76a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

geopandas/_compat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
PANDAS_GE_12 = Version(pd.__version__) >= Version("1.2.0")
2121
PANDAS_GE_13 = Version(pd.__version__) >= Version("1.3.0")
2222
PANDAS_GE_14 = Version(pd.__version__) >= Version("1.4.0rc0")
23-
23+
PANDAS_GE_20 = Version(pd.__version__) >= Version("2.0.0.dev0")
2424

2525
# -----------------------------------------------------------------------------
2626
# Shapely / PyGEOS compat

geopandas/io/tests/test_file.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import geopandas
1818
from geopandas import GeoDataFrame, read_file
19+
from geopandas._compat import PANDAS_GE_20
1920
from geopandas.io.file import _detect_driver, _EXTENSION_TO_DRIVER
2021

2122
from geopandas.testing import assert_geodataframe_equal, assert_geoseries_equal
@@ -309,7 +310,11 @@ def test_read_file_datetime_mixed_offsets(tmpdir):
309310
if FIONA_GE_1814:
310311
# Convert mixed timezones to UTC equivalent
311312
assert is_datetime64_any_dtype(res["date"])
312-
assert res["date"].dt.tz == pytz.utc
313+
if not PANDAS_GE_20:
314+
utc = pytz.utc
315+
else:
316+
utc = datetime.timezone.utc
317+
assert res["date"].dt.tz == utc
313318
else:
314319
# old fiona and pyogrio ignore timezones and read as datetimes successfully
315320
assert is_datetime64_any_dtype(res["date"])

0 commit comments

Comments
 (0)