Skip to content

BUG: Raise error if not busdaycalendar #61250

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

j-hendricks
Copy link
Contributor

Closes #60647. Raises TypeError if anything other than None or np.busdaycalendar is passed to calendar. Also added test for this exception as well as a note in whatsnew

@j-hendricks j-hendricks requested a review from WillAyd as a code owner April 8, 2025 01:34
@@ -78,7 +80,7 @@ def test_weekmask_and_holidays(self):

@pytest.mark.filterwarnings("ignore:Non:pandas.errors.PerformanceWarning")
def test_calendar(self):
calendar = USFederalHolidayCalendar()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So was this just getting ignored before? If not and the behavior was working as expected, we should continue supporting these arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding, rhshadrach thinks we should only support np.busdaycalender for the argument calendar. He said in the issue, "I think we should raise when a calendar that is not an np.busdaycalender is passed instead of silently ignoring it.".

Therefore, I have edited the constructor to raise a TypeError if anything other than None or a np.busdaycalender is passed. Happy to change if needed!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I agree in principle, but with the modified docs and tests in this PR we have some testing with AbstractHolidayCalendar and it's subclasses, so this PR would introduce breaking behavior.

Therefore, I would suggest first investigating if those docs/tests are producing correct behavior. If so, I would suggest calling the original issue a bug that needs fixing, but it would still be good to add validation to allow calendar: None | np.businesscalendar | AbstractHolidayCalendar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: CustomBusinessDay not respecting calendar
3 participants