Skip to content

Commit 523afa8

Browse files
matsidzimroeschke
andauthored
TST: Added test for date_range for bug GH#57456 (#59519)
TST: Added test for date_range for bug #57456 Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 8bece71 commit 523afa8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pandas/tests/indexes/datetimes/test_date_range.py

+18
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,24 @@ def test_range_with_timezone_and_custombusinessday(self, start, period, expected
12581258
expected = DatetimeIndex(expected).as_unit("ns")
12591259
tm.assert_index_equal(result, expected)
12601260

1261+
def test_data_range_custombusinessday_partial_time(self, unit):
1262+
# GH#57456
1263+
offset = offsets.CustomBusinessDay(weekmask="Sun Mon Tue")
1264+
start = datetime(2024, 2, 6, 23)
1265+
# end datetime is partial and not in the offset
1266+
end = datetime(2024, 2, 14, 14)
1267+
result = date_range(start, end, freq=offset, unit=unit)
1268+
expected = DatetimeIndex(
1269+
[
1270+
"2024-02-06 23:00:00",
1271+
"2024-02-11 23:00:00",
1272+
"2024-02-12 23:00:00",
1273+
"2024-02-13 23:00:00",
1274+
],
1275+
dtype=f"M8[{unit}]",
1276+
)
1277+
tm.assert_index_equal(result, expected)
1278+
12611279

12621280
class TestDateRangeNonNano:
12631281
def test_date_range_reso_validation(self):

0 commit comments

Comments
 (0)