Skip to content

TST: unhoused test_offsets fn to custom business hour (#27045) #43218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pandas/tests/tseries/offsets/test_custom_business_hour.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,21 @@ def test_us_federal_holiday_with_datetime(self):
result = t0 + bhour_us * 8
expected = Timestamp("2014-01-21 15:00:00")
assert result == expected


@pytest.mark.parametrize(
"weekmask, expected_time, mult",
[
["Mon Tue Wed Thu Fri Sat", "2018-11-10 09:00:00", 10],
["Tue Wed Thu Fri Sat", "2018-11-13 08:00:00", 18],
],
)
def test_custom_businesshour_weekmask_and_holidays(weekmask, expected_time, mult):
# GH 23542
holidays = ["2018-11-09"]
bh = CustomBusinessHour(
start="08:00", end="17:00", weekmask=weekmask, holidays=holidays
)
result = Timestamp("2018-11-08 08:00") + mult * bh
expected = Timestamp(expected_time)
assert result == expected
18 changes: 0 additions & 18 deletions pandas/tests/tseries/offsets/test_offsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,21 +795,3 @@ def test_dateoffset_immutable(attribute):
msg = "DateOffset objects are immutable"
with pytest.raises(AttributeError, match=msg):
setattr(offset, attribute, 5)


@pytest.mark.parametrize(
"weekmask, expected_time, mult",
[
["Mon Tue Wed Thu Fri Sat", "2018-11-10 09:00:00", 10],
["Tue Wed Thu Fri Sat", "2018-11-13 08:00:00", 18],
],
)
def test_custom_businesshour_weekmask_and_holidays(weekmask, expected_time, mult):
# GH 23542
holidays = ["2018-11-09"]
bh = CustomBusinessHour(
start="08:00", end="17:00", weekmask=weekmask, holidays=holidays
)
result = Timestamp("2018-11-08 08:00") + mult * bh
expected = Timestamp(expected_time)
assert result == expected