Skip to content

Commit

Permalink
TST: Added test for date_range for bug GH#57456 (#59519)
Browse files Browse the repository at this point in the history
TST: Added test for date_range for bug #57456

Co-authored-by: Matthew Roeschke <[email protected]>
  • Loading branch information
matsidzi and mroeschke authored Aug 15, 2024
1 parent 8bece71 commit 523afa8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pandas/tests/indexes/datetimes/test_date_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,24 @@ def test_range_with_timezone_and_custombusinessday(self, start, period, expected
expected = DatetimeIndex(expected).as_unit("ns")
tm.assert_index_equal(result, expected)

def test_data_range_custombusinessday_partial_time(self, unit):
# GH#57456
offset = offsets.CustomBusinessDay(weekmask="Sun Mon Tue")
start = datetime(2024, 2, 6, 23)
# end datetime is partial and not in the offset
end = datetime(2024, 2, 14, 14)
result = date_range(start, end, freq=offset, unit=unit)
expected = DatetimeIndex(
[
"2024-02-06 23:00:00",
"2024-02-11 23:00:00",
"2024-02-12 23:00:00",
"2024-02-13 23:00:00",
],
dtype=f"M8[{unit}]",
)
tm.assert_index_equal(result, expected)


class TestDateRangeNonNano:
def test_date_range_reso_validation(self):
Expand Down

0 comments on commit 523afa8

Please sign in to comment.