Skip to content

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

@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

Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label May 17, 2025
@mroeschke
Copy link
Member

Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.

@mroeschke mroeschke closed this May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: CustomBusinessDay not respecting calendar

3 participants