Skip to content

Commit 898897e

Browse files
committed
Add unit test for fold hashing fix
1 parent 46fc705 commit 898897e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pandas/tests/tslibs/test_timezones.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,24 @@ def test_maybe_get_tz_offset_only():
166166

167167
tz = timezones.maybe_get_tz("UTC-02:45")
168168
assert tz == timezone(-timedelta(hours=2, minutes=45))
169+
170+
171+
def test_hash_timestamp_with_fold():
172+
# see gh-33931
173+
america_chicago = dateutil.tz.gettz("America/Chicago")
174+
transition_1 = Timestamp(
175+
year=2013, month=11, day=3, hour=1, minute=0, tzinfo=america_chicago
176+
)
177+
transition_2 = Timestamp(
178+
year=2013, month=11, day=3, hour=1, minute=0, fold=1, tzinfo=america_chicago
179+
)
180+
assert hash(transition_1) == hash(transition_2)
181+
182+
america_santiago = dateutil.tz.gettz("America/Santiago")
183+
transition_3 = Timestamp(
184+
year=2021, month=4, day=3, hour=23, minute=0, tz=america_santiago
185+
)
186+
transition_4 = Timestamp(
187+
year=2021, month=4, day=3, hour=23, minute=0, fold=1, tz=america_santiago
188+
)
189+
assert hash(transition_3) == hash(transition_4)

0 commit comments

Comments
 (0)