Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmylow committed Jan 11, 2024
1 parent fa8b4dd commit f988306
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pandas/tests/indexes/datetimes/test_date_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -1703,3 +1703,18 @@ def test_date_range_freqstr_matches_offset(self, freqstr, offset):
idx2 = date_range(start=sdate, end=edate, freq=offset)
assert len(idx1) == len(idx2)
assert idx1.freq == idx2.freq

def test_date_range_negative_freq_year_end_inbounds(self, unit):
# GH#56147
rng = date_range(
start="2023-10-31 00:00:00",
end="2021-10-31 00:00:00",
freq="-1YE",
unit=unit,
)
exp = DatetimeIndex(
["2022-12-31 00:00:00", "2021-12-31 00:00:00"],
dtype=f"M8[{unit}]",
freq="-1YE",
)
tm.assert_index_equal(rng, exp)

0 comments on commit f988306

Please sign in to comment.