-
-
Notifications
You must be signed in to change notification settings - Fork 539
Add Bermuda holidays #2571
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
Add Bermuda holidays #2571
Conversation
Resolves vacanza#2412.
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughSupport for Bermuda's public holidays has been added. This includes a new Bermuda holiday provider, integration into the registry, documentation updates, and a comprehensive test suite verifying holiday logic and edge cases from 1948 onward. Changes
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes detected. Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (2)holidays/countries/bermuda.py (2)
tests/countries/test_bermuda.py (1)
🪛 Pylint (3.3.7)holidays/countries/bermuda.py[convention] 26-26: Line too long (167/100) (C0301) [convention] 27-27: Line too long (188/100) (C0301) [convention] 28-28: Line too long (188/100) (C0301) [convention] 29-29: Line too long (212/100) (C0301) [convention] 30-30: Line too long (188/100) (C0301) [convention] 31-31: Line too long (188/100) (C0301) [convention] 32-32: Line too long (112/100) (C0301) [convention] 33-33: Line too long (208/100) (C0301) [convention] 120-120: Line too long (163/100) (C0301) [convention] 122-122: Line too long (161/100) (C0301) [convention] 123-123: Line too long (180/100) (C0301) [convention] 125-125: Line too long (131/100) (C0301) [convention] 126-126: Line too long (183/100) (C0301) [convention] 128-128: Line too long (148/100) (C0301) [convention] 129-129: Line too long (178/100) (C0301) [convention] 1-1: Missing module docstring (C0114) [convention] 108-108: Missing class docstring (C0115) [convention] 112-112: Missing class docstring (C0115) [refactor] 116-116: Too few public methods (0/2) (R0903) tests/countries/test_bermuda.py[convention] 1-1: Missing module docstring (C0114) [convention] 19-19: Missing class docstring (C0115) [warning] 21-21: Number of parameters was 4 in 'TestCase.setUpClass' and is now 1 in overriding 'TestBermuda.setUpClass' method (W0221) [convention] 25-25: Missing function or method docstring (C0116) [convention] 28-28: Missing function or method docstring (C0116) [convention] 31-31: Missing function or method docstring (C0116) [convention] 40-40: Missing function or method docstring (C0116) [convention] 53-53: Missing function or method docstring (C0116) [convention] 65-65: Missing function or method docstring (C0116) [convention] 90-90: Missing function or method docstring (C0116) [convention] 106-106: Missing function or method docstring (C0116) [convention] 123-123: Missing function or method docstring (C0116) [convention] 148-148: Missing function or method docstring (C0116) [convention] 173-173: Missing function or method docstring (C0116) [convention] 186-186: Missing function or method docstring (C0116) [convention] 200-200: Missing function or method docstring (C0116) [convention] 213-213: Missing function or method docstring (C0116) [convention] 226-226: Missing function or method docstring (C0116) 🔇 Additional comments (16)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
I could not find the original text of the Public Holidays Amendment Act 1947, only the consolidated version containing all the amendments. But I have implemented the holidays by trying to reconstruct it from the amendments and old captures from Internet Archive. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #2571 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 224 225 +1
Lines 14315 14362 +47
Branches 2010 2017 +7
=========================================
+ Hits 14315 14362 +47 ☔ 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.
I haven't looked at the sources yet, so just technical suggestions.
June 5, 2007 Public Holiday Official sources for But they don't contain holiday name, so it's better not to replace the existing ones, but rather to add them as an addition. |
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Co-authored-by: Panpakorn Siripanich <19505219+PPsyrius@users.noreply.github.com> Signed-off-by: Kriti Birda <164247895+kritibirda26@users.noreply.github.com>
add cup match/emancipation day test fix somers days/mary prince test fix bermuda day test for 2020
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: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
README.md
(2 hunks)holidays/countries/__init__.py
(1 hunks)holidays/countries/bermuda.py
(1 hunks)holidays/registry.py
(1 hunks)tests/countries/test_bermuda.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
tests/countries/test_bermuda.py (1)
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.
holidays/countries/bermuda.py (1)
Learnt from: KJhellico
PR: vacanza/holidays#2524
File: holidays/countries/grenada.py:81-83
Timestamp: 2025-05-03T20:16:58.203Z
Learning: In the Vacanza holidays library, localization (l10n) comments are always written in American English (en_US locale), even when the translatable strings use different regional spellings. For example, comments use "Labor Day" while the corresponding translatable string might use "Labour Day".
🧬 Code Graph Analysis (1)
holidays/countries/__init__.py (1)
holidays/countries/bermuda.py (3)
Bermuda
(22-105)BM
(108-109)BMU
(112-113)
🪛 Pylint (3.3.7)
tests/countries/test_bermuda.py
[convention] 1-1: Missing module docstring
(C0114)
[convention] 19-19: Missing class docstring
(C0115)
[warning] 21-21: Number of parameters was 4 in 'TestCase.setUpClass' and is now 1 in overriding 'TestBermuda.setUpClass' method
(W0221)
[convention] 25-25: Missing function or method docstring
(C0116)
[convention] 28-28: Missing function or method docstring
(C0116)
[convention] 31-31: Missing function or method docstring
(C0116)
[convention] 40-40: Missing function or method docstring
(C0116)
[convention] 53-53: Missing function or method docstring
(C0116)
[convention] 65-65: Missing function or method docstring
(C0116)
[convention] 90-90: Missing function or method docstring
(C0116)
[convention] 104-104: Missing function or method docstring
(C0116)
[convention] 121-121: Missing function or method docstring
(C0116)
[convention] 146-146: Missing function or method docstring
(C0116)
[convention] 171-171: Missing function or method docstring
(C0116)
[convention] 184-184: Missing function or method docstring
(C0116)
[convention] 198-198: Missing function or method docstring
(C0116)
[convention] 211-211: Missing function or method docstring
(C0116)
[convention] 224-224: Missing function or method docstring
(C0116)
holidays/countries/bermuda.py
[convention] 26-26: Line too long (167/100)
(C0301)
[convention] 27-27: Line too long (188/100)
(C0301)
[convention] 28-28: Line too long (188/100)
(C0301)
[convention] 29-29: Line too long (212/100)
(C0301)
[convention] 30-30: Line too long (188/100)
(C0301)
[convention] 31-31: Line too long (188/100)
(C0301)
[convention] 32-32: Line too long (112/100)
(C0301)
[convention] 33-33: Line too long (208/100)
(C0301)
[convention] 120-120: Line too long (163/100)
(C0301)
[convention] 122-122: Line too long (161/100)
(C0301)
[convention] 123-123: Line too long (180/100)
(C0301)
[convention] 125-125: Line too long (131/100)
(C0301)
[convention] 126-126: Line too long (183/100)
(C0301)
[convention] 128-128: Line too long (148/100)
(C0301)
[convention] 129-129: Line too long (178/100)
(C0301)
[convention] 1-1: Missing module docstring
(C0114)
[convention] 108-108: Missing class docstring
(C0115)
[convention] 112-112: Missing class docstring
(C0115)
[refactor] 116-116: Too few public methods (0/2)
(R0903)
🔇 Additional comments (16)
README.md (2)
108-108
: Documentation correctly updated for new country support.The country count increment from 180 to 181 properly reflects the addition of Bermuda.
304-309
: Bermuda entry correctly added to countries table.Good placement in alphabetical order between Benin and Bolivia. The entry follows the standard format with appropriate empty fields for subdivisions, languages, and categories.
holidays/countries/__init__.py (1)
37-37
: Import statement correctly added for Bermuda support.Follows the established pattern and maintains alphabetical ordering. All expected classes (Bermuda, BM, BMU) are properly imported.
holidays/registry.py (1)
45-45
: Registry entry correctly added for Bermuda.Proper tuple format with correct ISO codes (BM, BMU) and alphabetical placement maintained.
tests/countries/test_bermuda.py (8)
19-27
: Well-structured test class with comprehensive coverage.Good setup covering the full range from 1948-2050. Test structure follows established patterns and includes both observed and non-observed year testing.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 19-19: Missing class docstring
(C0115)
[warning] 21-21: Number of parameters was 4 in 'TestCase.setUpClass' and is now 1 in overriding 'TestBermuda.setUpClass' method
(W0221)
[convention] 25-25: Missing function or method docstring
(C0116)
31-38
: Special holidays properly tested.Covers all the one-off holidays mentioned in the PR objectives - excellent attention to historical accuracy.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 31-31: Missing function or method docstring
(C0116)
40-51
: New Year's Day test follows best practices.Good coverage of observed holiday rules with specific test cases for weekend adjustments.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 40-40: Missing function or method docstring
(C0116)
65-89
: Bermuda Day test captures complex evolution.Well done testing the different rules over time - from fixed May 24 to various Friday/Monday calculations. The observed holiday testing is thorough.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 65-65: Missing function or method docstring
(C0116)
90-102
: Queen's Birthday test properly handles discontinuation.Correctly tests that the holiday existed until 2008 and then stopped - good historical accuracy.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 90-90: Missing function or method docstring
(C0116)
121-144
: Cup Match/Emancipation Day transition well tested.Properly captures the name change from "Cup Match Day" to "Emancipation Day" in 2000.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 121-121: Missing function or method docstring
(C0116)
146-169
: Somers/Mary Prince Day transition correctly tested.Good coverage of another name change, this time in 2020.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 146-146: Missing function or method docstring
(C0116)
224-237
: Comprehensive 2025 integration test.Nice summary test that validates the complete holiday set for a specific year.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 224-224: Missing function or method docstring
(C0116)
holidays/countries/bermuda.py (4)
13-19
: Imports look good.The imports are well-organized and include all necessary components for the Bermuda holidays implementation.
22-46
: Solid class structure and initialization.The class properly inherits from all required mixins and sets appropriate defaults. The initialization correctly handles all parent classes and sets a sensible observed rule.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 26-26: Line too long (167/100)
(C0301)
[convention] 27-27: Line too long (188/100)
(C0301)
[convention] 28-28: Line too long (188/100)
(C0301)
[convention] 29-29: Line too long (212/100)
(C0301)
[convention] 30-30: Line too long (188/100)
(C0301)
[convention] 31-31: Line too long (188/100)
(C0301)
[convention] 32-32: Line too long (112/100)
(C0301)
[convention] 33-33: Line too long (208/100)
(C0301)
47-106
: Holiday logic implementation looks comprehensive.The holiday definitions cover all major Bermuda holidays with proper date calculations and observed rules. The logic correctly handles historical changes in holiday dates and names based on the legislative amendments.
116-142
: Special holidays implementation is well-documented.The static holidays class properly defines one-off holidays with comprehensive references. The structure follows the expected pattern for special holiday definitions.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 120-120: Line too long (163/100)
(C0301)
[convention] 122-122: Line too long (161/100)
(C0301)
[convention] 123-123: Line too long (180/100)
(C0301)
[convention] 125-125: Line too long (131/100)
(C0301)
[convention] 126-126: Line too long (183/100)
(C0301)
[convention] 128-128: Line too long (148/100)
(C0301)
[convention] 129-129: Line too long (178/100)
(C0301)
[refactor] 116-116: Too few public methods (0/2)
(R0903)
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Kriti Birda <164247895+kritibirda26@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: 1
♻️ Duplicate comments (1)
holidays/countries/bermuda.py (1)
95-95
: 🧹 Nitpick (assertive)Use American English in code comments.
Per project convention, code comments should use American English spelling.
- # Labor Day. + # Labor Day.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
holidays/countries/bermuda.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
holidays/countries/bermuda.py (2)
Learnt from: KJhellico
PR: vacanza/holidays#2524
File: holidays/countries/grenada.py:81-83
Timestamp: 2025-05-03T20:16:58.203Z
Learning: In the Vacanza holidays library, localization (l10n) comments are always written in American English (en_US locale), even when the translatable strings use different regional spellings. For example, comments use "Labor Day" while the corresponding translatable string might use "Labour Day".
Learnt from: KJhellico
PR: vacanza/holidays#2571
File: holidays/countries/bermuda.py:108-110
Timestamp: 2025-05-31T15:11:42.143Z
Learning: In the holidays library project, alias classes (like BM, BMU) do not have docstrings. This is a project-specific convention.
🧬 Code Graph Analysis (1)
holidays/countries/bermuda.py (4)
holidays/groups/christian.py (3)
_add_good_friday
(308-317)_add_christmas_day
(208-216)_add_christmas_day_two
(218-226)holidays/groups/international.py (2)
_add_new_years_day
(126-134)_add_remembrance_day
(166-174)holidays/groups/custom.py (1)
StaticHolidays
(18-47)holidays/observed_holiday_base.py (1)
ObservedHolidayBase
(101-243)
🪛 Pylint (3.3.7)
holidays/countries/bermuda.py
[convention] 26-26: Line too long (167/100)
(C0301)
[convention] 27-27: Line too long (188/100)
(C0301)
[convention] 28-28: Line too long (188/100)
(C0301)
[convention] 29-29: Line too long (212/100)
(C0301)
[convention] 30-30: Line too long (188/100)
(C0301)
[convention] 31-31: Line too long (188/100)
(C0301)
[convention] 32-32: Line too long (112/100)
(C0301)
[convention] 33-33: Line too long (208/100)
(C0301)
[convention] 120-120: Line too long (163/100)
(C0301)
[convention] 122-122: Line too long (161/100)
(C0301)
[convention] 123-123: Line too long (180/100)
(C0301)
[convention] 125-125: Line too long (131/100)
(C0301)
[convention] 126-126: Line too long (183/100)
(C0301)
[convention] 128-128: Line too long (148/100)
(C0301)
[convention] 129-129: Line too long (178/100)
(C0301)
[convention] 1-1: Missing module docstring
(C0114)
[convention] 108-108: Missing class docstring
(C0115)
[convention] 112-112: Missing class docstring
(C0115)
[refactor] 116-116: Too few public methods (0/2)
(R0903)
🪛 GitHub Actions: CI/CD
holidays/countries/bermuda.py
[error] 68-68: AttributeError: 'Bermuda' object has no attribute '_add_holiday_3rd_mon_of_june' called during test setup in TestBermuda.
🔇 Additional comments (2)
holidays/countries/bermuda.py (2)
22-46
: Well-structured class definition.The class properly inherits from all necessary mixins and the constructor correctly initializes each component. Good use of default observed rule and comprehensive documentation with official references.
🧰 Tools
🪛 Pylint (3.3.7)
[convention] 26-26: Line too long (167/100)
(C0301)
[convention] 27-27: Line too long (188/100)
(C0301)
[convention] 28-28: Line too long (188/100)
(C0301)
[convention] 29-29: Line too long (212/100)
(C0301)
[convention] 30-30: Line too long (188/100)
(C0301)
[convention] 31-31: Line too long (188/100)
(C0301)
[convention] 32-32: Line too long (112/100)
(C0301)
[convention] 33-33: Line too long (208/100)
(C0301)
116-142
: Excellent static holidays implementation.The special holidays are well-documented with authoritative references and follow the proper structure. The implementation correctly defines one-off holidays with appropriate dates and names.
🧰 Tools 🪛 Pylint (3.3.7)
[convention] 120-120: Line too long (163/100)
(C0301)
[convention] 122-122: Line too long (161/100)
(C0301)
[convention] 123-123: Line too long (180/100)
(C0301)
[convention] 125-125: Line too long (131/100)
(C0301)
[convention] 126-126: Line too long (183/100)
(C0301)
[convention] 128-128: Line too long (148/100)
(C0301)
[convention] 129-129: Line too long (178/100)
(C0301)
[refactor] 116-116: Too few public methods (0/2)
(R0903)
|
Already LGTM, but maybe it's worth adding l10n (en_BM, en_US), since Labour Day holiday is present? |
I asked @KJhellico and we agreed that l10n part can be implemented after today's release) |
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, great start for GSoC coding phase!
Resolves #2412.
Proposed change
Add Bermuda holidays
Type of change
holidays
functionality in general)Checklist
make check
, all checks and tests are green