Skip to content

Commit 80ab012

Browse files
committed
add nonexistent test
1 parent 6ed30c4 commit 80ab012

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pandas/tests/indexes/datetimes/test_date_range.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,3 +1752,19 @@ def test_date_range_tzaware_endpoints_accept_ambiguous(self):
17521752
"1916-08-01", "1916-12-01", freq="MS", tz="Europe/Oslo", ambiguous=True
17531753
)
17541754
tm.assert_index_equal(res, exp)
1755+
1756+
def test_date_range_tzaware_endpoints_accept_nonexistent(self):
1757+
# Europe/London spring-forward: 2015-03-29 01:30 does not exist.
1758+
start = Timestamp("2015-03-28 01:30", tz="Europe/London")
1759+
end = Timestamp("2015-03-30 01:30", tz="Europe/London")
1760+
1761+
result = date_range(start, end, freq="D", nonexistent="shift_forward")
1762+
expected = [
1763+
Timestamp("2015-03-28 01:30:00+00:00"),
1764+
Timestamp(
1765+
"2015-03-29 02:00:00+01:00"
1766+
), # shifted forward over next valid wall time
1767+
Timestamp("2015-03-30 01:30:00+01:00"),
1768+
]
1769+
1770+
assert list(result) == expected

0 commit comments

Comments
 (0)