-
-
Notifications
You must be signed in to change notification settings - Fork 554
Add _add_observed
/_move_holiday
's force_observed
support
#2986
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
Conversation
Summary by CodeRabbit
WalkthroughAdds forced-observed support to observed-holiday core, introduces a Saint Patrick’s Day helper, and updates multiple country modules (Canada, New Zealand, Fiji, Ireland, Montserrat, UK, US) and tests to use the new helpers and forced nearest‑Monday observation rules; removes some _get_nearest_monday helpers. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings
🧬 Code graph analysis (1)holidays/observed_holiday_base.py (6)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (1)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Ruff (0.13.3)holidays/observed_holiday_base.py�[1;31mruff failed�[0m Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2986 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 305 305
Lines 17996 17998 +2
Branches 2321 2323 +2
=========================================
+ Hits 17996 17998 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Great refactoring! Especially Canada and New Zealand.
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Panpakorn Siripanich <19505219+PPsyrius@users.noreply.github.com>
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Panpakorn Siripanich <19505219+PPsyrius@users.noreply.github.com>
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.
Actionable comments posted: 3
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
holidays/observed_holiday_base.py
(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
🧬 Code graph analysis (1)
holidays/observed_holiday_base.py (6)
holidays/countries/angola.py (2)
_is_observed
(60-63)_add_observed
(65-71)holidays/countries/tonga.py (1)
_add_observed
(96-99)tests/test_holiday_base.py (1)
_add_observed
(43-50)holidays/countries/jersey.py (1)
_add_observed
(63-69)holidays/countries/israel.py (1)
_add_observed
(52-55)holidays/holiday_base.py (1)
pop
(1166-1195)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build distribution
- GitHub Check: Test docs build
🔇 Additional comments (2)
holidays/observed_holiday_base.py (2)
159-159
: LGTM!The control flow correctly implements the forced-observed logic, matching the past review suggestion. When
force_observed=True
, it bypasses the normalself.observed
and_is_observed(dt)
checks.
207-207
: LGTM!The parameter pass-through is correct and maintains consistency between
_move_holiday
and_add_observed
.
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.
LGTM! 👍
|
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.
LGTM 👍
Smart ObservedRule
application.
Proposed change
Based on PR discussion in #2984.
_add_observed
/_move_holiday
'sforce_observed
support._move_holiday_forced( ... )
as shorthand alias for_move_holiday( ..., force_observed=True, show_observed_label=False)
.TestFiji
to the latest test case standards._add_saint_patricks_day
forChristianHolidays
Holiday Group.Type of change
holidays
functionality in general)Checklist
make check
locally; all checks and tests passed.