Skip to content

Commit 5b7c41c

Browse files
committed
test: Adapt the CustomTimeseries test fixture
Comparison of tz-naive and tz-aware datetime-like objects has been removed in Pandas 2.0. See: pandas-dev/pandas#49492 Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
1 parent e39d7a2 commit 5b7c41c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python/tests/integration/arcticdb/version_store/test_update_with_date_range.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ def __init__(self, wrapped: pd.DataFrame, *, with_timezone_attr: bool, timezone_
5353

5454
def __getitem__(self, item):
5555
if isinstance(item, slice):
56-
open_ended = slice(item.start + timedelta(microseconds=1), item.stop - timedelta(microseconds=1), item.step)
56+
# Comparing datetimes with timezone to datetimes without timezone has been deprecated in Pandas 1.2.0
57+
# (see https://github.com/pandas-dev/pandas/pull/36148/) and is not support anymore in Pandas 2.0
58+
# (see https://github.com/pandas-dev/pandas/pull/49492/).
59+
# We explicitly remove the timezone from the start and stop of the slice to be able to use the
60+
# index of the wrapped DataFrame.
61+
start_wo_tz = item.start.replace(tzinfo=None) + timedelta(microseconds=1)
62+
stop_wo_tz = item.stop.replace(tzinfo=None) - timedelta(microseconds=1)
63+
open_ended = slice(start_wo_tz, stop_wo_tz, item.step)
5764
return CustomTimeseries(
5865
self.wrapped[open_ended],
5966
with_timezone_attr=self.with_timezone_attr,

0 commit comments

Comments
 (0)