Skip to content

Commit 5c06cbb

Browse files
committed
TST: xfail test for DatetimeIndex.union across DST boundary (GH#62915)
1 parent 415830f commit 5c06cbb

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

pandas/tests/indexes/datetimes/test_setops.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,30 @@ def test_union3(self, sort, box):
6060
result = first.union(case, sort=sort)
6161
tm.assert_index_equal(result, expected)
6262

63+
64+
@pytest.mark.xfail(reason="see GH#62915: union across DST boundary", strict=False)
65+
def test_union_across_dst_boundary_xfail():
66+
# US/Eastern DST spring-forward on 2021-03-14 at 02:00 (02:00-02:59 local time does not exist)
67+
tz = "US/Eastern"
68+
# Left side spans up to the missing hour window
69+
left = date_range("2021-03-14 00:00", periods=3, freq="H", tz=tz)
70+
# right side continues from the first valid post-DST hour
71+
right = date_range("2021-03-14 03:00", periods=3, freq="H", tz=tz)
72+
73+
# Expect a union that preserves tz and includes valid hours without duplicates
74+
expected = DatetimeIndex(
75+
[
76+
Timestamp("2021-03-14 00:00", tz=tz),
77+
Timestamp("2021-03-14 01:00", tz=tz),
78+
Timestamp("2021-03-14 03:00", tz=tz),
79+
Timestamp("2021-03-14 04:00", tz=tz),
80+
Timestamp("2021-03-14 05:00", tz=tz),
81+
]
82+
)
83+
84+
result = left.union(right)
85+
tm.assert_index_equal(result, expected)
86+
6387
@pytest.mark.parametrize("tz", tz)
6488
def test_union(self, tz, sort):
6589
rng1 = date_range("1/1/2000", freq="D", periods=5, tz=tz)

0 commit comments

Comments
 (0)