-
Notifications
You must be signed in to change notification settings - Fork 14k
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
fix(utils): evaluate date parser multiple holiday results correctly #23685
Conversation
- Bump holidays version family from ">=0.17.2, <0.18" to ">=0.22, <0.23" - Change holiday search result evaluation logic for multiple date cases - Change holiday lookup from `icontains` (default) to `istartswith`. - Add tests for described cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Eugene,
I've done a couple of half-hearted attempts to update the requirements. It seems it hasn't been done for a while. Or maybe for some other reason a lot of dependencies are getting their version bumped when I run
I'd appreciate some guidance on how to properly resolve this sort of issues, e.g.:
@EugeneTorap, I appreciate you jumping in and tagging the right people as I was within a whisker of creating a post on Slack's #contributing channel asking for help. |
Changes LGTM, but the deps will need to be fixed. @arkid15r do you need help updating the requirements? |
Right, I do. The instructions are clear and easy to follow. The output is what bothers me -- a lot of unrelated [to this PR] changes. |
@arkid15r I wrote before reading your thorough post properly, sorry for asking what you already had posted. I'm looking into this, but my env seems to be slightly messed up right now, and |
@arkid15r try to run: pip-compile-multi --no-upgrade And commit only |
It worked, I guess the yesterday's requirements update might have helped. The workflows need to be approved/run one more time. Thank you! |
Codecov Report
@@ Coverage Diff @@
## master #23685 +/- ##
==========================================
+ Coverage 67.87% 67.98% +0.10%
==========================================
Files 1925 1936 +11
Lines 74389 74914 +525
Branches 8108 8140 +32
==========================================
+ Hits 50494 50928 +434
- Misses 21818 21894 +76
- Partials 2077 2092 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@arkid15r Pls, fix the |
result = datetime_eval( | ||
"holiday('Juneteenth', datetime('2022-01-01T00:00:00'), 'US')" | ||
) | ||
expected = datetime(2022, 6, 19, 0, 0, 0) | ||
assert result == expected | ||
|
||
result = datetime_eval( | ||
"holiday('Independence Day', datetime('2022-01-01T00:00:00'), 'US')" | ||
) | ||
expected = datetime(2022, 7, 4, 0, 0, 0) | ||
assert result == expected | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi there, the US holiday case was added to L273 so the duplicated test case is not necessary. Thanks for supporting more widely holiday types!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zhaoyongjie,
I read L273 as UK's (technically GB) test. And even if it was the US test I'd suggest to keep the L279-289 Juneteenth related tests as they specifically cover the wrong parser behaviour this PR trying to address.
Thanks for reviewing this!
👍 I reverted the local mypy fixes, hope this fixes the issue. |
SUMMARY
The purpose of this PR is fixing incorrect datetime_eval for holiday results containing more than one entry (even with observed=False flag set):
icontains
(default) toistartswith
.TESTING INSTRUCTIONS
The added unit tests would fail with the currently used approach.
The described cases include:
ADDITIONAL INFORMATION