-
-
Notifications
You must be signed in to change notification settings - Fork 543
Add Bhutan holidays #2437
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 Bhutan holidays #2437
Conversation
…ate holiday names to Tibetan script
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughThis pull request introduces Bhutan holidays into the holidays library and extends support for the Tibetan lunisolar calendar. It updates the README to include Bhutan, adds Bhutan-specific holiday classes and country codes, and incorporates Tibetan calendar holiday calculations. Localization files for Bhutanese holidays in Dzongkha and English are added. The registry is updated with Bhutan’s country codes. Comprehensive tests for Bhutan holidays and Tibetan calendar functionality are included. Additionally, a new contributor is added to the AUTHORS list. Changes
Assessment against linked issues
Suggested reviewers
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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
|
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.
Copilot reviewed 12 out of 14 changed files in this pull request and generated no comments.
Files not reviewed (2)
- holidays/locale/dz_BT/LC_MESSAGES/BT.po: Language not supported
- holidays/locale/en_US/LC_MESSAGES/BT.po: Language not supported
Comments suppressed due to low confidence (1)
tests/countries/test_bhutan.py:76
- [nitpick] Consider zero-padding the day in the Dashain test date for consistency (i.e., use "2022-10-05" instead of "2022-10-5").
self.assertHoliday("2022-10-5", "2024-10-12", "2025-10-02")
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
🔭 Outside diff range comments (1)
tests/calendars/test_tibetan.py (1)
1-24
: 🧹 Nitpick (assertive)Test coverage could be expanded
While the test correctly verifies the instance type, it would be more robust to include tests for actual functionality of the Tibetan calendar calculations.
Consider adding additional test cases that verify specific date calculations or holiday determinations based on the Tibetan calendar. For example:
def test_specific_tibetan_holiday(self): # Test a specific holiday date calculation year = 2025 expected_date = date(2025, 2, 19) # Example date calculated_date = self.tibetan_calendar.get_holiday_date(year, "some_holiday_name") self.assertEqual(calculated_date, expected_date)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (14)
AUTHORS.md
(1 hunks)README.md
(2 hunks)holidays/calendars/__init__.py
(1 hunks)holidays/calendars/tibetan.py
(1 hunks)holidays/countries/__init__.py
(1 hunks)holidays/countries/bhutan.py
(1 hunks)holidays/groups/__init__.py
(1 hunks)holidays/groups/tibetan.py
(1 hunks)holidays/locale/dz_BT/LC_MESSAGES/BT.po
(1 hunks)holidays/locale/en_US/LC_MESSAGES/BT.po
(1 hunks)holidays/registry.py
(1 hunks)tests/calendars/test_tibetan.py
(1 hunks)tests/countries/test_bhutan.py
(1 hunks)tests/test_holiday_groups.py
(2 hunks)
🧰 Additional context used
🧬 Code Definitions (6)
holidays/groups/__init__.py (1)
holidays/groups/tibetan.py (1)
TibetanCalendarHolidays
(20-104)
holidays/countries/__init__.py (1)
holidays/countries/bhutan.py (3)
Bhutan
(20-85)BT
(88-89)BTN
(92-93)
tests/test_holiday_groups.py (3)
tests/common.py (1)
TestCase
(28-338)holidays/holiday_base.py (3)
HolidayBase
(57-1275)_populate
(870-892)_populate
(1387-1390)tests/test_holiday_base.py (4)
_populate
(52-63)_populate
(96-98)_populate
(104-107)_populate
(676-680)
holidays/countries/bhutan.py (1)
holidays/groups/tibetan.py (9)
TibetanCalendarHolidays
(20-104)_add_day_of_offering
(58-64)_add_blessed_rainy_day
(90-96)_add_losar
(50-56)_add_buddha_parinirvana
(42-48)_add_buddha_first_sermon
(66-72)_add_birth_of_guru_rinpoche
(74-80)_add_death_of_zhabdrung
(82-88)_add_dashain
(98-104)
tests/countries/test_bhutan.py (1)
holidays/countries/bhutan.py (3)
Bhutan
(20-85)BT
(88-89)BTN
(92-93)
holidays/groups/tibetan.py (1)
holidays/calendars/tibetan.py (9)
_TibetanLunisolar
(29-827)buddha_parinirvana_date
(805-806)losar_date
(808-809)day_of_offering_date
(811-812)buddha_first_sermon_date
(814-815)birth_of_guru_rinpoche_date
(817-818)death_of_zhabdrung_date
(820-821)blessed_rainy_day_date
(823-824)dashain_date
(826-827)
🔇 Additional comments (51)
AUTHORS.md (1)
15-15
: Added contributor appropriatelyThe addition of Aneesh Angane to the contributors list maintains the alphabetical ordering, which is good practice.
holidays/groups/__init__.py (1)
28-28
: Import added correctlyThe import for
TibetanCalendarHolidays
is properly placed in alphabetical order and follows the module's established import patterns. This is necessary for supporting Bhutan holidays that follow the Tibetan calendar.holidays/countries/__init__.py (1)
35-35
: Country import added correctlyThe import for Bhutan with its country codes (BT, BTN) follows the project's convention of alphabetical ordering and maintains consistency with other country imports. This change properly integrates Bhutan into the library.
holidays/calendars/__init__.py (1)
28-28
: Calendar imports added correctlyThe import for
_TibetanLunisolar
and_CustomTibetanHolidays
maintains alphabetical ordering and follows the established pattern in the file. These calendar classes are essential for supporting the Tibetan lunar calendar calculations needed for Bhutan holidays.holidays/locale/dz_BT/LC_MESSAGES/BT.po (2)
30-92
: Translation strings need to be filledAll message translations are currently empty. This is typical for a new locale file, but translations should eventually be provided.
Is this intentional as a template for future translation work? If you're planning to add translations in a follow-up PR, that's fine - just confirming this approach.
16-28
: 🧹 Nitpick (assertive)Check metadata date values
The metadata shows dates in 2025 which is in the future. Consider updating to current dates.
-"POT-Creation-Date: 2025-04-04 06:20+0000\n" -"PO-Revision-Date: 2025-04-04 06:20+0000\n" +"POT-Creation-Date: 2024-04-04 06:20+0000\n" +"PO-Revision-Date: 2024-04-04 06:20+0000\n"Likely an incorrect or invalid review comment.
holidays/registry.py (1)
43-43
: LGTM - Bhutan entry added correctlyThe Bhutan entry follows the established format and is correctly positioned alphabetically in the countries dictionary.
README.md (2)
102-102
: Updated country count correctlyThe count of supported countries has been correctly incremented from 165 to 166.
283-289
: LGTM - Bhutan entry added correctlyThe new entry for Bhutan is correctly formatted and positioned alphabetically in the table.
holidays/locale/en_US/LC_MESSAGES/BT.po (2)
1-29
: Looks good: File headers and metadata properly set upThe file headers and metadata are correctly configured with appropriate copyright information, project version, and language settings.
30-93
: All holiday translations look correct and well-structuredThe translations from Tibetan to English for all Bhutanese holidays are properly formatted with msgid/msgstr pairs. Each holiday translation includes the appropriate punctuation and follows a consistent pattern.
tests/test_holiday_groups.py (2)
22-23
: Import for TibetanCalendarHolidays correctly addedThe TibetanCalendarHolidays import is properly added to the existing imports list, keeping them organized alphabetically.
133-157
: New TestTibetanCalendarHolidays class follows established patternsThe new test class follows the same structure as the existing test classes in the file, with a proper inheritance hierarchy and test method implementation. The test successfully validates that 8 different Tibetan calendar holidays can be added and correctly appear in the holidays dictionary.
holidays/countries/bhutan.py (5)
1-18
: Header and imports correctly set upThe file includes the standard copyright header and necessary imports for the Bhutan holidays implementation.
20-33
: Bhutan class definition and metadata properly establishedThe Bhutan class is correctly defined with inheritance from both HolidayBase and TibetanCalendarHolidays. The class includes appropriate metadata:
- Country code "BT"
- PUBLIC category support
- Default language "dz_BT" with "en_US" as additional supported language
- Start year of 1970
The documentation includes helpful references for the holiday information.
34-37
: Constructor properly initializes parent classesThe constructor correctly initializes the TibetanCalendarHolidays parent class explicitly and uses super() for the HolidayBase initialization, following best practices for multiple inheritance.
38-86
: Holiday population method comprehensively covers Bhutanese holidaysThe _populate_public_holidays method properly implements:
- Fixed-date holidays (Jan 2, Feb 21-23, May 2, Nov 1, Nov 11, Dec 17)
- Tibetan lunisolar calendar-based holidays
All holiday names use the translation function (tr) with Dzongkha text, allowing for proper localization.
88-94
: Country code aliases correctly definedTwo class aliases (BT and BTN) are properly defined as subclasses of Bhutan, following the project's pattern for providing alternative country code access.
tests/countries/test_bhutan.py (7)
1-30
: File header and imports properly set upThe test file includes the standard copyright header and necessary imports for testing the Bhutan holiday implementation.
31-36
: Test class setup correctly configuredThe TestBhutan class properly inherits from both CommonCountryTests and TestCase. The setUpClass method is correctly implemented to test years from 1970 to 2050, aligning with the start_year defined in the Bhutan class.
37-39
: Country aliases test implemented correctlyThe test_country_aliases method ensures that the main Bhutan class and its aliases (BT, BTN) are correctly associated.
40-42
: Start year validation test implemented correctlyThe test correctly verifies that no holidays exist before the start_year (1970) of the Bhutan class.
43-67
: Fixed holidays tests are comprehensive and well-structuredThe test_fixed_holidays method thoroughly tests all fixed-date holidays for Bhutan across the entire range of years (1970-2050), including:
- Nyilo (Jan 2)
- King's Birthday (Feb 21-23)
- Birth Anniversary of Third Druk Gyalpo (May 2)
- Coronation of King Jigme Khesar Namgyel (Nov 1)
- Birth Anniversary of Fourth Druk Gyalpo (Nov 11)
- National Day (Dec 17)
68-77
: Tibetan calendar-based holiday tests use appropriate sample datesThe test_tibetan_based_holidays method correctly tests sample dates for the Tibetan calendar-based holidays:
- Losar
- Blessed Rainy Day
- Dashain
Using specific sample dates across multiple years is an efficient approach to testing these variable-date holidays.
78-106
: Localization tests properly validate English translationsThe test_l10n_en_us_2024_dates method comprehensively verifies all localized holiday names for 2024, ensuring that each holiday's translation matches the expected English text.
holidays/groups/tibetan.py (12)
1-12
: License and header information correctly formatted.The file header follows the project's standard format with appropriate license and authorship information.
13-17
: Appropriate imports for the module.The imports are clean and correctly include only what's needed for this module's functionality.
20-24
: Class inheritance structure looks good.TibetanCalendarHolidays extends EasternCalendarHolidays, which is the appropriate parent class for this type of calendar. The docstring clearly describes the purpose of the class.
25-28
: Constructor implementation is correct.The constructor properly initializes the Tibetan calendar instance and handles both default and custom implementations.
29-41
: Helper method correctly extends parent functionality.The _add_tibetan_calendar_holiday method appropriately leverages the parent class's _add_eastern_calendar_holiday method, maintaining consistency with the project's design patterns.
42-49
: Buddha Parinirvana holiday correctly implemented.The method properly retrieves the holiday date from the Tibetan calendar and passes it to the helper method. The docstring accurately describes it as occurring on the 15th day of the 2nd lunar month.
50-57
: Losar holiday correctly implemented.The implementation retrieves the Losar date (Tibetan New Year) from the calendar and adds it with the appropriate name. Docstring correctly specifies it's on the 1st day of the 1st lunar month.
58-65
: Day of Offering holiday correctly implemented.The method correctly retrieves and adds the Day of Offering holiday date. Docstring accurately describes it as the 15th day of the 10th lunar month.
66-73
: Buddha First Sermon holiday correctly implemented.The implementation for Buddha First Sermon retrieves the correct date from the calendar and passes it to the helper method. Docstring indicates it's on the 15th day of the 8th lunar month.
74-81
: Birth of Guru Rinpoche holiday correctly implemented.The method correctly retrieves the date for Birth of Guru Rinpoche. The docstring properly indicates it occurs on the 10th day of the 5th lunar month.
82-89
: Death of Zhabdrung holiday correctly implemented.The implementation correctly handles the Death of Zhabdrung holiday. Docstring accurately describes it as occurring on the 10th day of the 11th lunar month.
90-97
: Blessed Rainy Day holiday correctly implemented.The method correctly retrieves the Blessed Rainy Day holiday date. Docstring accurately describes it as the 15th day of the 7th lunar month.
holidays/calendars/tibetan.py (14)
1-12
: License and header information correctly formatted.The file header follows the project's standard format with appropriate license and authorship information.
13-18
: Imports are appropriate and follow project conventions.The imports include only what's needed and follow the project's import structure, including calendar-specific constants.
19-27
: Holiday name constants properly defined.Constants for all holiday names are defined, which promotes code readability and reduces the likelihood of string-related typos in the codebase.
29-130
: Buddha Parinirvana dates comprehensively provided.Dates for Buddha Parinirvana are provided from 1970 to 2068, covering almost a century of dates. This is thorough and provides good coverage for the library.
132-234
: Losar dates thoroughly implemented.Dates for Losar (Tibetan New Year) are provided from 1970 to 2070, giving comprehensive coverage. The date patterns follow the expected lunisolar calendar variations.
236-307
: Dashain dates implementation note.Dashain dates are only provided from 2001 to 2070, while most other holidays start from 1970. This is likely because Dashain is primarily a Nepali festival that was later adopted in Bhutan, but it's worth noting this different date range.
309-411
: Buddha First Sermon dates comprehensively provided.Dates for Buddha First Sermon are provided from 1970 to 2070, giving thorough coverage for the library.
510-612
: Birth of Guru Rinpoche dates comprehensively provided.Dates for Birth of Guru Rinpoche are provided from 1970 to 2070, providing excellent coverage.
713-797
: Blessed Rainy Day seems to have a mostly fixed date.Interesting to note that Blessed Rainy Day falls on September 23 for most years, with only some occasional shifts to September 22. This is different from the lunar pattern of other holidays and may reflect a specific astronomical event.
799-804
: Holiday date retrieval method is well implemented.The _get_holiday method efficiently handles both exact and estimated dates, with a clear priority system and return value. The implementation follows established patterns in the holidays library.
805-827
: Individual holiday methods follow consistent pattern.Each holiday date retrieval method follows the same consistent pattern, making the code maintainable and easy to understand.
830-831
: Custom calendar implementation is minimal but sufficient.The _CustomTibetanHolidays class provides a minimal but sufficient implementation through multiple inheritance. This follows the pattern used elsewhere in the library for custom calendar implementations.
614-711
:❓ Verification inconclusive
Day of Offering dates have some gaps.
The Day of Offering dates have a few missing years (e.g., 1978, 2031, etc.). This may be intentional due to calendar intricacies, but should be verified.
🏁 Script executed:
#!/bin/bash # Check for missing years in the Day of Offering dates echo "Checking for missing years in Day of Offering dates (1970-2070):" for year in $(seq 1970 2070); do if ! grep -q "^\ *$year:" holidays/calendars/tibetan.py -A 1 | grep -q "DAY_OF_OFFERING_DATES"; then echo "Year $year is missing from DAY_OF_OFFERING_DATES" fi doneLength of output: 249
Action: Request Verification of Missing Years in DAY_OF_OFFERING_DATES
There appear to be gaps in the defined dates—for instance, 1978 and 2031 are not present. However, our automated check encountered an issue because the
seq
command wasn't available in the current environment. Please verify if these omitted years are intentional due to calendar intricacies. To aid in this, consider updating the verification script (for example, using a Python-based loop) so that missing years can be correctly identified.
- Consider replacing the shell script’s use of
seq
with an alternative approach compatible with your environment.- Re-run the verification to confirm whether the missing years are expected or require correction.
413-508
:❓ Verification inconclusive
Death of Zhabdrung dates have some gaps.
While the Death of Zhabdrung dates largely cover the 1970-2070 period, there appear to be a few missing years (e.g., 1982, 1992, etc.). This might be intentional due to calendar complexities, but it would be good to verify.
🏁 Script executed:
#!/bin/bash # Check for missing years in the Death of Zhabdrung dates echo "Checking for missing years in Death of Zhabdrung dates (1970-2070):" for year in $(seq 1970 2070); do if ! grep -q "^\ *$year:" holidays/calendars/tibetan.py -A 1 | grep -q "DEATH_OF_ZHABDRUNG_DATES"; then echo "Year $year is missing from DEATH_OF_ZHABDRUNG_DATES" fi doneLength of output: 255
Attention: Verify Missing Year Entries in Death of Zhabdrung Dates
The current dictionary for Death of Zhabdrung dates covers most years between 1970 and 2070, but a few years (e.g., 1982, 1992) are missing. Note that the automated verification script encountered an error due to the unavailability of the
seq
command in the environment. I recommend updating the script to use bash’s built-in range expansion (e.g.,for year in {1970..2070}
) to properly validate the continuity of the year entries. Once that change is applied, please re-run the check to confirm whether the missing years are intentional due to calendar considerations or if they require updates.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #2437 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 210 213 +3
Lines 13348 13453 +105
Branches 1909 1909
==========================================
+ Hits 13348 13453 +105 ☔ 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.
Actionable comments posted: 2
♻️ Duplicate comments (14)
holidays/locale/en_US/LC_MESSAGES/BT.po (14)
63-63
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "Day of Offering." +msgstr "Day of Offering"
87-87
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "Death of Zhabdrung." +msgstr "Death of Zhabdrung"
67-67
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "Blessed Rainy Day." +msgstr "Blessed Rainy Day"
83-83
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "Birth of Guru Rinpoche." +msgstr "Birth of Guru Rinpoche"
79-79
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "Buddha's First Sermon." +msgstr "Buddha's First Sermon"
59-59
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "National Day." +msgstr "National Day"
35-35
: 🧹 Nitpick (assertive)Remove the period from the holiday name
The translation should be consistent with other holiday names in the project. Based on the previous review comment, periods should be removed from holiday names.
-msgstr "King's Birthday (Day 1)." +msgstr "King's Birthday (Day 1)"
43-43
: 🧹 Nitpick (assertive)Remove the period from the holiday name
For consistency with other holiday name formatting:
-msgstr "King's Birthday (Day 3)." +msgstr "King's Birthday (Day 3)"
91-91
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "Dashain." +msgstr "Dashain"
47-47
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "Birth Anniversary of Third Druk Gyalpo." +msgstr "Birth Anniversary of Third Druk Gyalpo"
39-39
: 🧹 Nitpick (assertive)Remove the period from the holiday name
The translation should be consistent with other holiday names in the project.
-msgstr "King's Birthday (Day 2)." +msgstr "King's Birthday (Day 2)"
71-71
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "Losar." +msgstr "Losar"
55-55
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "Birth Anniversary of the Fourth Druk Gyalpo." +msgstr "Birth Anniversary of the Fourth Druk Gyalpo"
75-75
: 🧹 Nitpick (assertive)Remove the period from the holiday name
-msgstr "Buddha Parinirvana." +msgstr "Buddha Parinirvana"
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
holidays/locale/en_US/LC_MESSAGES/BT.po
(1 hunks)
🔇 Additional comments (1)
holidays/locale/en_US/LC_MESSAGES/BT.po (1)
31-31
: Remove the period from the holiday nameThe translation should be consistent with other holiday names in the project. Based on the previous review comment, periods should be removed from holiday names.
-msgstr "Nyilo." +msgstr "Nyilo"
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 (3)
tests/countries/test_bhutan.py (3)
40-41
: 🧹 Nitpick (assertive)Method name could be more concise.
Consider renaming this method to
test_no_holidays()
for consistency with other test files.- def test_no_holidays_before_start_year(self): + def test_no_holidays(self):
43-67
: 🛠️ Refactor suggestionConsider splitting fixed holiday tests into separate methods.
For better maintainability and following project conventions, it's recommended to use separate test methods for each holiday. This approach improves test isolation and makes failures easier to diagnose.
Here's an example of how you could restructure this:
def test_nyilo(self): self.assertHoliday(f"{year}-01-02" for year in range(1970, 2050)) def test_kings_birthday_day_1(self): self.assertHoliday(f"{year}-02-21" for year in range(1970, 2050)) # Similarly for other holidays
78-106
: 🧹 Nitpick (assertive)Remove redundant comments in localization test.
The inline comments after each holiday assertion are redundant as they repeat information already evident from the holiday names themselves.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
tests/countries/test_bhutan.py
(1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
tests/countries/test_bhutan.py (1)
holidays/countries/bhutan.py (3)
Bhutan
(20-85)BT
(88-89)BTN
(92-93)
🔇 Additional comments (3)
tests/countries/test_bhutan.py (3)
1-23
: Redundant file header detected.The file header information is duplicated (lines 1-12 and 13-23). This creates unnecessary redundancy in your code. Please remove one of these header blocks.
37-39
: LGTM: Country aliases test is well implemented.The test correctly verifies that Bhutan, BT, and BTN classes are properly aliased.
107-107
: 🛠️ Refactor suggestionMissing default localization test.
You need to add a
test_l10n_default()
method to verify the default language (dz_BT) localization. This is a standard test for all country modules.Example implementation:
def test_l10n_default(self): self.assertLocalizedHolidays( # Add date-name pairs for default language (dz_BT) ("2024-01-02", "ཉི་ལོག་"), # Add more holidays with their localized names )
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
♻️ Duplicate comments (3)
tests/countries/test_bhutan.py (3)
13-24
: 🧹 Nitpick (assertive)Remove duplicated file header.
The file header information is duplicated. The second header block (lines 13-24) is redundant and should be removed as noted in past review comments.
-# tests/countries/test_bhutan.py -# ------------------------------ -# A fast, efficient Python library for generating country, province and state -# specific sets of holidays on the fly. It aims to make determining whether a -# specific date is a holiday as fast and flexible as possible. -# -# Authors: Vacanza Team and individual contributors (see AUTHORS.md file) -# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 -# ryanss <ryanssdev@icloud.com> (c) 2014-2017 -# Website: https://github.com/vacanza/holidays -# License: MIT (see LICENSE file) -
43-67
: 🛠️ Refactor suggestionSplit fixed holidays into separate test methods.
Following project conventions and past review comments, each fixed holiday should have its own test method instead of testing all fixed holidays in a single method.
Example refactoring approach:
def test_nyilo(self): """Test for Nyilo (Winter Solstice) holiday.""" self.assertHoliday(f"{year}-01-02" for year in range(1970, 2050)) def test_kings_birthday(self): """Test for King's Birthday holidays.""" # King's Birthday (Day 1) self.assertHoliday(f"{year}-02-21" for year in range(1970, 2050)) # King's Birthday (Day 2) self.assertHoliday(f"{year}-02-22" for year in range(1970, 2050)) # King's Birthday (Day 3) self.assertHoliday(f"{year}-02-23" for year in range(1970, 2050)) def test_birth_anniversary_third_druk_gyalpo(self): """Test for Birth Anniversary of Third Druk Gyalpo holiday.""" self.assertHoliday(f"{year}-05-02" for year in range(1970, 2050)) # Continue with separate methods for each remaining fixed holiday
68-76
: 🛠️ Refactor suggestionSplit Tibetan-based holidays into separate test methods.
Similar to the fixed holidays, each Tibetan-based holiday should have its own test method for better organization and clarity.
Example refactoring approach:
def test_losar(self): """Test for Losar (Tibetan New Year) holiday.""" self.assertHoliday("2022-03-03", "2024-02-11", "2025-02-28") def test_blessed_rainy_day(self): """Test for Blessed Rainy Day holiday.""" self.assertHoliday("2022-09-23", "2024-09-23", "2025-09-23") def test_dashain(self): """Test for Dashain holiday.""" self.assertHoliday("2022-10-5", "2024-10-12", "2025-10-02")
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
holidays/calendars/tibetan.py
(1 hunks)holidays/locale/dz_BT/LC_MESSAGES/BT.po
(1 hunks)holidays/locale/en_US/LC_MESSAGES/BT.po
(1 hunks)tests/countries/test_bhutan.py
(1 hunks)tests/test_holiday_groups.py
(2 hunks)
🧰 Additional context used
🧬 Code Definitions (2)
tests/test_holiday_groups.py (3)
tests/common.py (1)
TestCase
(28-338)holidays/holiday_base.py (3)
HolidayBase
(57-1275)_populate
(870-892)_populate
(1387-1390)tests/test_holiday_base.py (4)
_populate
(52-63)_populate
(96-98)_populate
(104-107)_populate
(676-680)
tests/countries/test_bhutan.py (1)
holidays/countries/bhutan.py (3)
Bhutan
(20-85)BT
(88-89)BTN
(92-93)
🔇 Additional comments (9)
holidays/calendars/tibetan.py (1)
413-508
:❓ Verification inconclusive
Confirm missing years for DEATH_OF_ZHABDRUNG.
Some years—such as 1982 and 1992—appear to be missing in this dictionary. Confirm that you intend to skip these years or add them for completeness.
Please confirm the data source and run a script to list all missing years within this range:
🏁 Script executed:
#!/bin/bash # Searching through the dictionary for missing consecutive years # This will parse lines 413-508 and list any year from 1970..2070 that is not defined awk '/DEATH_OF_ZHABDRUNG_DATES = {/,/}/ {print}' holidays/calendars/tibetan.py | \ grep '^[[:space:]]*[0-9]' | sed 's/^\s*\([0-9]\+\).*/\1/' | sort -n > /tmp/found_years.txt # Compare with a generated complete list of years 1970..2070 seq 1970 2070 > /tmp/all_years.txt # Show missing comm -23 /tmp/all_years.txt /tmp/found_years.txtLength of output: 407
Action: Please verify the DEATH_OF_ZHABDRUNG_DATES dictionary in
holidays/calendars/tibetan.py
(lines 413–508).The verification using a Python script shows that the dictionary is missing the following years within the 1970–2070 range: 1982, 1992, 2001, 2010, 2011, 2020, and 2041. These omissions include, but go beyond, the originally noted missing years (1982 and 1992).
- Confirm if these missing years are intentionally skipped based on your data source.
- If completeness is required, consider adding the missing entries or document why these years are excluded.
🏁 Script executed:
#!/usr/bin/env python3 import re with open("holidays/calendars/tibetan.py") as f: content = f.read() match = re.search(r"DEATH_OF_ZHABDRUNG_DATES\s*=\s*\{(.*?)\}", content, re.DOTALL) if match: block = match.group(1) found_years = re.findall(r"^\s*([0-9]{4})\s*:", block, re.MULTILINE) found_years = set(map(int, found_years)) all_years = set(range(1970, 2071)) missing = sorted(all_years - found_years) print("Missing years: " + ", ".join(map(str, missing))) else: print("Dictionary block not found")Length of output: 462
Action: Verify Missing Years in the DEATH_OF_ZHABDRUNG_DATES Dictionary
It appears that when verifying the dictionary inholidays/calendars/tibetan.py
(lines 413–508), several years within the range 1970 to 2070 are not defined. Based on the intended check, the following years seem to be omitted:
- 1982
- 1992
- 2001
- 2010
- 2011
- 2020
- 2041
Please confirm whether these omissions are intentional based on your data source. If the missing years should be defined, consider updating the dictionary accordingly or adding documentation to clarify why these years are skipped.
holidays/locale/en_US/LC_MESSAGES/BT.po (1)
49-51
: Ensure naming consistency with “King Jigme Khesar Namgyel’s Coronation”.For clarity and consistency with the comment on line 49, consider including “King” in the holiday name.
tests/test_holiday_groups.py (3)
22-22
: Import for TibetanCalendarHolidays looks correct.This import aligns with the PR's goal of adding Bhutan holiday support that relies on the Tibetan calendar.
135-142
: Test class definition follows the correct pattern.The
TestTibetanCalendarHolidays
class follows the established pattern of other test classes in this file. The class correctly combinesHolidayBase
andTibetanCalendarHolidays
.
145-154
: Test successfully verifies multiple Tibetan calendar holidays.The test method effectively verifies that the holiday addition methods work correctly for the Tibetan calendar. Unlike other test classes that check for out-of-range dates, this test verifies that holidays can be successfully added for a valid year.
tests/countries/test_bhutan.py (4)
25-36
: Class definition and setup method look correct.The import statements, class definition, and setup method follow the established patterns for country test files.
37-42
: Alias and start year tests look good.The tests for country aliases and checking that no holidays exist before the start year are well-implemented.
78-97
: Localization test for English looks good.The test for English (US) localization is well-implemented and covers all the expected holidays.
99-117
: Default localization test correctly implemented.The test for default language (Dzongkha) localization is well-implemented and covers all the expected holidays. This addresses a past review comment requesting this test.
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/locale/en_US/LC_MESSAGES/BT.po (1)
12-14
: 🧹 Nitpick (assertive)Replace placeholder header text
The file contains placeholder text that needs to be updated.
# License: MIT (see LICENSE file) -# SOME DESCRIPTIVE TITLE -# This file is distributed under the same license as the Holidays package. -# FIRST AUTHOR <EMAIL@ADDRESS>, 2025. +# +# Bhutan holidays en_US localization. +#
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
holidays/countries/bhutan.py
(1 hunks)holidays/locale/dz_BT/LC_MESSAGES/BT.po
(1 hunks)holidays/locale/en_US/LC_MESSAGES/BT.po
(1 hunks)tests/test_holiday_groups.py
(2 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
holidays/countries/bhutan.py (1)
holidays/groups/tibetan.py (9)
TibetanCalendarHolidays
(20-104)_add_day_of_offering
(58-64)_add_blessed_rainy_day
(90-96)_add_losar
(50-56)_add_buddha_parinirvana
(42-48)_add_buddha_first_sermon
(66-72)_add_birth_of_guru_rinpoche
(74-80)_add_death_of_zhabdrung
(82-88)_add_dashain
(98-104)
🔇 Additional comments (14)
tests/test_holiday_groups.py (2)
22-22
: Good addition of TibetanCalendarHolidays import.Clean addition of the new holiday group import that maintains alphabetical order in the import list.
135-154
: Well-structured test class following existing patterns.Your test implementation follows the established pattern in this file - creating a test subclass, initializing it, adding specific holidays, and verifying the count.
Unlike other test classes (TestBalineseSakaCalendarHolidays, TestPersianCalendarHolidays, TestThaiCalendarHolidays), this one doesn't set an
end_year
property to test out-of-range dates. Is this intentional?class TestTibetanCalendarHolidays(TestCase): def test_add_tibetan_calendar_holiday(self): # Check for out-of-range dates. class TestHolidays(HolidayBase, TibetanCalendarHolidays): + end_year = XXXX # Consider adding this if out-of-range testing is needed
Great job on the holiday names - they're consistent with the codebase convention (no periods at the end).
holidays/countries/bhutan.py (7)
1-18
: Import and boilerplate section looks well-structuredThe imports and header section follow the project's conventions with proper documentation and necessary imports from the holidays library.
20-32
: Well-defined class with proper documentationThe Bhutan class is appropriately documented with references to official sources, and includes all necessary class attributes (country code, supported categories, languages, etc.).
34-37
: Constructor properly initializes parent classesThe initialization sequence is correct, calling the TibetanCalendarHolidays constructor first, then using super() to initialize the HolidayBase.
38-41
: Nyilo holiday implementation looks goodThe Nyilo holiday is properly implemented with its Dzongkha name.
42-50
: King's Birthday properly implemented across multiple daysThe implementation correctly adds the three-day celebration for the King's Birthday with appropriate Dzongkha names.
51-85
: Thorough implementation of Bhutanese holidaysThe implementation covers both fixed date holidays (like Birth Anniversary dates and National Day) and Tibetan calendar-based holidays (like Losar and Buddha Parinirvana). All holidays include proper Dzongkha names.
88-93
: Country code alias classes properly definedThe BT and BTN classes provide appropriate ISO code aliases for the Bhutan class, following the library's convention.
holidays/locale/dz_BT/LC_MESSAGES/BT.po (3)
19-22
: Ensure consistency in translator informationThe translator information appears to be filled in correctly, but ensure the email address matches your contribution identity.
30-31
: Fill in the Dzongkha translationThe "Nyilo" entry is empty in the translation. Consider adding the Dzongkha equivalent for completeness.
29-91
:✅ Verification successful
Empty translation strings may need to be filled
All translation strings (msgstr) are empty. If the intention is to use the msgid values directly, this is fine. Otherwise, consider adding the appropriate translations.
Verify the project's localization approach by checking other locale files:
🏁 Script executed:
#!/bin/bash # Check how other locale files handle translations find holidays/locale -name "*.po" | grep -v dz_BT | head -n 2 | xargs grep -A 1 "msgid" | head -n 20Length of output: 793
Attention: Intentional Use of Empty Translation Strings
After verifying other locale files (e.g.,
holidays/locale/am/LC_MESSAGES/ET.po
), it’s clear that leaving allmsgstr
values empty is a consistent approach across the project. If the intention is to use themsgid
values as fallback translations, this implementation is correct. Otherwise, please add the appropriate localized strings.holidays/locale/en_US/LC_MESSAGES/BT.po (2)
20-21
: Update translator informationThe translator name contains placeholder text.
-"Last-Translator: FULL NAME <anesh.angane@gmail.com>\n" +"Last-Translator: Aneesh Angane <anesh.angane@gmail.com>\n"
29-91
: Translation strings look complete and appropriateAll holidays have been properly translated to English with appropriate naming conventions. The translations maintain consistency in formatting without trailing periods.
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Aneesh Angane <113509759+code-with-aneesh@users.noreply.github.com>
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Aneesh Angane <113509759+code-with-aneesh@users.noreply.github.com>
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Aneesh Angane <113509759+code-with-aneesh@users.noreply.github.com>
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Aneesh Angane <113509759+code-with-aneesh@users.noreply.github.com>
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Aneesh Angane <113509759+code-with-aneesh@users.noreply.github.com>
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Aneesh Angane <113509759+code-with-aneesh@users.noreply.github.com>
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Aneesh Angane <113509759+code-with-aneesh@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: 7
♻️ Duplicate comments (2)
tests/countries/test_bhutan.py (2)
65-67
: 🛠️ Refactor suggestionUse
assertHolidayName
for more complete testing.Similar to the Losar test, use
assertHolidayName
to verify both the date and name of the Blessed Rainy Day holiday.def test_blessed_rainy_day(self): - self.assertHoliday("2022-09-23", "2024-09-23", "2025-09-23") + self.assertHolidayName("2022-09-23", "ཁྲུས་འབབས་ཀྱི་ཉིནམ།") + self.assertHolidayName("2024-09-23", "ཁྲུས་འབབས་ཀྱི་ཉིནམ།") + self.assertHolidayName("2025-09-23", "ཁྲུས་འབབས་ཀྱི་ཉིནམ།")
62-64
: 🛠️ Refactor suggestionUse
assertHolidayName
instead ofassertHoliday
for Tibetan calendar holidays.For more thorough testing, use
assertHolidayName
to verify both the date and the name of the holiday.def test_losar(self): - self.assertHoliday("2022-03-03", "2024-02-11", "2025-02-28") + self.assertHolidayName("2022-03-03", "ལལོ་གསར་") + self.assertHolidayName("2024-02-11", "ལལོ་གསར་") + self.assertHolidayName("2025-02-28", "ལལོ་གསར་")
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
holidays/calendars/tibetan.py
(1 hunks)holidays/countries/bhutan.py
(1 hunks)holidays/locale/dz_BT/LC_MESSAGES/BT.po
(1 hunks)holidays/locale/en_US/LC_MESSAGES/BT.po
(1 hunks)tests/countries/test_bhutan.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
holidays/locale/en_US/LC_MESSAGES/BT.po (2)
Learnt from: PPsyrius
PR: vacanza/holidays#2437
File: holidays/locale/dz_BT/LC_MESSAGES/BT.po:0-0
Timestamp: 2025-04-06T14:52:35.679Z
Learning: When suggesting changes to .po files in the holidays project, follow the standardized header format:
- Default language format: "# [COUNTRY-NAME-NORMAL] holidays. #"
- Non-default language format: "# [COUNTRY-NAME-NORMAL] holidays [LANGUAGE-CODE] localization. #"
For example, for Bhutan in Dzongkha, use "# Bhutan holidays dz_BT localization. #"
Learnt from: PPsyrius
PR: vacanza/holidays#2437
File: holidays/locale/dz_BT/LC_MESSAGES/BT.po:12-12
Timestamp: 2025-04-06T14:44:59.785Z
Learning: Use standardized .po file headers for localization files in the holidays project:
- Default language format: "# [COUNTRY-NAME-NORMAL] holidays. #"
- Other languages format: "# [COUNTRY-NAME-NORMAL] holidays [LANGUAGE-CODE] localization. #"
holidays/locale/dz_BT/LC_MESSAGES/BT.po (2)
Learnt from: PPsyrius
PR: vacanza/holidays#2437
File: holidays/locale/dz_BT/LC_MESSAGES/BT.po:0-0
Timestamp: 2025-04-06T14:52:35.679Z
Learning: When suggesting changes to .po files in the holidays project, follow the standardized header format:
- Default language format: "# [COUNTRY-NAME-NORMAL] holidays. #"
- Non-default language format: "# [COUNTRY-NAME-NORMAL] holidays [LANGUAGE-CODE] localization. #"
For example, for Bhutan in Dzongkha, use "# Bhutan holidays dz_BT localization. #"
Learnt from: PPsyrius
PR: vacanza/holidays#2437
File: holidays/locale/dz_BT/LC_MESSAGES/BT.po:12-12
Timestamp: 2025-04-06T14:44:59.785Z
Learning: Use standardized .po file headers for localization files in the holidays project:
- Default language format: "# [COUNTRY-NAME-NORMAL] holidays. #"
- Other languages format: "# [COUNTRY-NAME-NORMAL] holidays [LANGUAGE-CODE] localization. #"
tests/countries/test_bhutan.py (1)
Learnt from: KJhellico
PR: vacanza/holidays#2437
File: tests/countries/test_bhutan.py:18-18
Timestamp: 2025-04-08T14:31:01.824Z
Learning: According to Python's PEP 8 style guide, top-level function and class definitions should be surrounded by two blank lines, while method definitions inside a class are surrounded by a single blank line.
🧬 Code Definitions (3)
holidays/countries/bhutan.py (2)
holidays/groups/tibetan.py (9)
TibetanCalendarHolidays
(20-104)_add_day_of_offering
(58-64)_add_blessed_rainy_day
(90-96)_add_losar
(50-56)_add_buddha_parinirvana
(42-48)_add_buddha_first_sermon
(66-72)_add_birth_of_guru_rinpoche
(74-80)_add_death_of_zhabdrung
(82-88)_add_dashain
(98-104)holidays/holiday_base.py (1)
HolidayBase
(57-1275)
tests/countries/test_bhutan.py (2)
tests/common.py (5)
TestCase
(28-338)assertAliases
(121-130)assertNoHolidays
(292-294)assertHoliday
(150-152)assertLocalizedHolidays
(327-338)holidays/countries/bhutan.py (2)
Bhutan
(20-85)BT
(88-89)
holidays/calendars/tibetan.py (1)
holidays/holiday_base.py (1)
get
(941-964)
🔇 Additional comments (10)
holidays/calendars/tibetan.py (2)
29-34
: Docstring references are well done.Thank you for including the calendar source in the docstring. This improves clarity for future maintainers.
811-834
: Holiday methods are consistent.Each public method cleanly delegates to
_get_holiday
. This consolidation reduces duplication and is easy to follow.holidays/locale/dz_BT/LC_MESSAGES/BT.po (1)
1-14
: Header matches default language format.Having “# Bhutan holidays.” is consistent with the convention for the default language. Nicely done.
holidays/locale/en_US/LC_MESSAGES/BT.po (1)
13-13
: Header follows localization format.“# Bhutan holidays en_US localization” aligns with the recommended style for non-default locales.
holidays/countries/bhutan.py (2)
86-88
: The implementation looks good.The BT class is correctly implemented as an alias for the Bhutan class, following the pattern used by other country implementations.
90-92
: The implementation looks good.The BTN class is correctly implemented as an alias for the Bhutan class, following the pattern used by other country implementations.
tests/countries/test_bhutan.py (4)
21-22
: The implementation looks good.The setUpClass method correctly initializes the test environment for the years 1970 to 2050, following the pattern used by other country test implementations.
71-89
: The implementation looks good.The localization test for the default language (dz_BT) is correctly implemented, verifying holiday dates and names for 2024.
91-110
: The implementation looks good.The localization test for English (US) is correctly implemented, verifying holiday dates and names for 2024.
30-33
:✅ Verification successful
Use
assertHolidayName
instead ofassertHoliday
for more complete testing.The
assertHoliday
method only checks if a date is a holiday but doesn't verify the holiday name. UseassertHolidayName
to verify both the date and name.def test_nyilo(self): for year in range(1970, 2050): - self.assertHoliday(f"{year}-01-02") + self.assertHolidayName(f"{year}-01-02", "ཉི་ལོག་")
🏁 Script executed:
#!/bin/bash # Check if assertHolidayName is used in other country tests rg "assertHolidayName" tests/countries/ -A 2Length of output: 85504
Action Required: Replace
assertHoliday
withassertHolidayName
in test_nyilo.The test in
tests/countries/test_bhutan.py
currently only verifies that the specified date is a holiday. Just like in other country tests (e.g., in Samoa and Vietnam), usingassertHolidayName
ensures that both the date and the holiday name are correctly validated. Please update the method as shown below:def test_nyilo(self): for year in range(1970, 2050): - self.assertHoliday(f"{year}-01-02") + self.assertHolidayName(f"{year}-01-02", "ཉི་ལོག་")This change will enhance the completeness of your test.
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
♻️ Duplicate comments (2)
holidays/groups/tibetan.py (2)
98-104
: 🧹 Nitpick (assertive)Enrich the Dashain docstring.
The docstring for Dashain lacks information about its calendar association and timing, unlike other methods that specify lunar month and day details.
def _add_dashain(self, name) -> Optional[date]: """ Add Dashain. + Follows the Solar calendar and is closely related to the Autumn Equinox. """ return self._add_tibetan_calendar_holiday( name, self._tibetan_calendar.dashain_date(self._year) )
25-28
: 🛠️ Refactor suggestionConsider calling the parent constructor.
The constructor currently omits a call to
super().__init__()
, which may bypass important initialization logic in theEasternCalendarHolidays
parent class. This could lead to unexpected behavior if the parent relies on specific setup steps.def __init__(self, cls=None, show_estimated=False) -> None: + super().__init__() self._tibetan_calendar = cls() if cls else _TibetanLunisolar() self._tibetan_calendar_show_estimated = show_estimated
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
holidays/groups/tibetan.py
(1 hunks)tests/countries/test_bhutan.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
tests/countries/test_bhutan.py (1)
Learnt from: KJhellico
PR: vacanza/holidays#2437
File: tests/countries/test_bhutan.py:18-18
Timestamp: 2025-04-08T14:31:01.824Z
Learning: According to Python's PEP 8 style guide, top-level function and class definitions should be surrounded by two blank lines, while method definitions inside a class are surrounded by a single blank line.
Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> Signed-off-by: Aneesh Angane <113509759+code-with-aneesh@users.noreply.github.com>
Yes, you should merge latest |
Done. |
I've implemented all the suggested changes. |
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 (3)
tests/countries/test_bhutan.py (3)
69-70
: 🧹 Nitpick (assertive)Add an assertion message for better error reporting.
Having a descriptive error message will improve debugging if the test fails.
- def test_blessed_rainy_day(self): - self.assertHolidayName("ཁྲུས་འབབས་ཀྱི་ཉིནམ།", ("2022-09-23", "2024-09-23", "2025-09-23")) + def test_blessed_rainy_day(self): + self.assertHolidayName( + "ཁྲུས་འབབས་ཀྱི་ཉིནམ།", + ("2022-09-23", "2024-09-23", "2025-09-23"), + "Blessed Rainy Day should be observed on the specified dates" + )
72-73
: 🧹 Nitpick (assertive)Add an assertion message for better error reporting.
Having a descriptive error message will improve debugging if the test fails.
- def test_dashain(self): - self.assertHolidayName("དྲང་བའི་བདུད་རྩིའི་ཉིམ།", ("2022-10-05", "2024-10-12", "2025-10-02")) + def test_dashain(self): + self.assertHolidayName( + "དྲང་བའི་བདུད་རྩིའི་ཉིམ།", + ("2022-10-05", "2024-10-12", "2025-10-02"), + "Dashain should be observed on the specified dates" + )
66-67
: 🧹 Nitpick (assertive)Add an assertion message for better error reporting.
Having a descriptive error message will improve debugging if the test fails.
- def test_losar(self): - self.assertHolidayName("ལལོ་གསར་", ("2022-03-03", "2024-02-11", "2025-02-28")) + def test_losar(self): + self.assertHolidayName( + "ལལོ་གསར་", + ("2022-03-03", "2024-02-11", "2025-02-28"), + "Losar dates should be correctly calculated based on Tibetan calendar" + )
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
tests/countries/test_bhutan.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
tests/countries/test_bhutan.py (4)
Learnt from: PPsyrius
PR: vacanza/holidays#2323
File: holidays/countries/macau.py:278-377
Timestamp: 2025-03-05T02:35:03.298Z
Learning: For Macau holiday implementations, it's preferable to maintain separate methods for different holiday categories (MANDATORY, GOVERNMENT, PUBLIC) as they are based on different sets of laws, making the code easier to maintain despite having multiple year-based conditionals.
Learnt from: PPsyrius
PR: vacanza/holidays#2323
File: holidays/countries/macau.py:284-366
Timestamp: 2025-03-04T11:41:56.389Z
Learning: For Macau holidays implementation, maintaining separate methods for each holiday category (PUBLIC, MANDATORY, GOVERNMENT) is preferred because these categories are based on different sets of laws and have distinct historical evolution.
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
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.
🧬 Code Graph Analysis (1)
tests/countries/test_bhutan.py (2)
tests/common.py (5)
CommonCountryTests
(356-374)assertAliases
(121-130)assertNoHolidays
(292-294)assertHolidayName
(195-199)assertLocalizedHolidays
(327-338)holidays/countries/bhutan.py (3)
Bhutan
(19-83)BT
(86-87)BTN
(90-91)
🔇 Additional comments (5)
tests/countries/test_bhutan.py (5)
18-19
: Double blank line before class definition looks good.This follows PEP 8 style guidelines for top-level class definitions, which should be surrounded by two blank lines.
21-22
: Implementation of setUpClass correctly sets up test years.The years range from 1970 to 2050 matches the implementation's start year from the
bhutan.py
file.
31-31
: Generator expression properly tests all years.Good use of generator expression to test Nyilo across all supported years.
75-93
: Localization test for default language is properly implemented.This test verifies all holiday names in the default language (Dzongkha) for 2024.
95-114
: Localization test for English (US) is properly implemented.This test verifies all holiday names in English for 2024. Placing it after the default language test follows project conventions.
# holidays | ||
# -------- | ||
# A fast, efficient Python library for generating country, province and state | ||
# specific sets of holidays on the fly. It aims to make determining whether a | ||
# specific date is a holiday as fast and flexible as possible. | ||
# | ||
# Authors: Vacanza Team and individual contributors (see AUTHORS.md file) | ||
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
# ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
# Website: https://github.com/vacanza/holidays | ||
# License: MIT (see LICENSE file) | ||
|
||
from unittest import TestCase | ||
|
||
from holidays.countries.bhutan import Bhutan, BT, BTN | ||
from tests.common import CommonCountryTests | ||
|
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.
🛠️ Refactor suggestion
Missing tests for some holidays defined in bhutan.py.
You've included tests for fixed-date holidays and some Tibetan calendar holidays, but there are other holidays defined in the implementation that don't have dedicated test methods.
Consider adding dedicated test methods for these holidays to ensure complete coverage:
- Day of Offering (བུ་ལྭ་ཕེུ་ཝི་ཉིམ)
- Buddha Parinirvana (།སངས་རྒྱས་པ་རི་ནིར་ཝན།)
- Buddha's First Sermon (སངས་རྒྱས་བཅོམ་ལྡན་འདས་ཀྱི་གསུང་ཆོས་དང་པོ།)
- Birth of Guru Rinpoche (སྐྱབས་རྗེ་གུ་རུ་རིན་པོ་ཆེའི་འཁྲུངས་སྐར།)
- Death of Zhabdrung (ཞབས་དྲུང་གི་འདས་དུས།)
These are included in the localization tests but should have their own test methods following the same pattern as your other holiday tests.
Signed-off-by: Aneesh Angane <113509759+code-with-aneesh@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
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
AUTHORS.md
(1 hunks)README.md
(2 hunks)holidays/countries/__init__.py
(1 hunks)holidays/registry.py
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
holidays/countries/__init__.py (1)
holidays/countries/bhutan.py (3)
Bhutan
(19-83)BT
(86-87)BTN
(90-91)
🪛 markdownlint-cli2 (0.17.2)
README.md
102-102: Multiple consecutive blank lines
Expected: 1; Actual: 2
(MD012, no-multiple-blanks)
🔇 Additional comments (5)
AUTHORS.md (1)
15-15
: Add new contributor "Aneesh Angane".
The new author entry is correctly placed in alphabetical order between “Andres Marrugo” and “Ankush Kapoor.”holidays/registry.py (1)
43-43
: Properly added Bhutan to the country registry.The entry follows the established pattern with country name and ISO codes (alpha-2 and alpha-3) in the correct position alphabetically.
holidays/countries/__init__.py (1)
35-35
: Correctly imported Bhutan holiday classes.The import statement correctly brings in the Bhutan holiday class and its ISO code aliases (BT, BTN) in the proper alphabetical position.
README.md (2)
103-103
: Total country count updated correctly.The count has been properly incremented from 167 to 168 to reflect the addition of Bhutan.
285-290
: Bhutan entry added correctly to the countries table.The entry includes all required information: country name, ISO code, supported languages (with "dz_BT" properly marked as default), and is positioned alphabetically in the table.
@@ -99,6 +99,7 @@ and detailed information. | |||
|
|||
## Available Countries | |||
|
|||
|
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.
🧹 Nitpick (assertive)
Fix multiple consecutive blank lines.
There are two consecutive blank lines here where only one is expected according to the project's markdown style guidelines.
101
-
We currently support 168 country codes. The standard way to refer to a country is by using its [ISO
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
We currently support 168 country codes. The standard way to refer to a country is by using its [ISO 3166-1 alpha-2 code]. |
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
102-102: Multiple consecutive blank lines
Expected: 1; Actual: 2
(MD012, no-multiple-blanks)
@@ -10,4 +10,4 @@ | |||
# Website: https://github.com/vacanza/holidays | |||
# License: MIT (see LICENSE file) | |||
|
|||
__version__ = "0.71" | |||
__version__ = "0.70" |
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.
This change is not needed.
# Day of Offering. | ||
self._add_day_of_offering(tr("བུ་ལྭ་ཕེུ་ཝི་ཉིམ")) | ||
|
||
# Blessed Rainy Day. | ||
self._add_blessed_rainy_day(tr("ཁྲུས་འབབས་ཀྱི་ཉིནམ།")) | ||
|
||
# Losar. | ||
self._add_losar(tr("ལལོ་གསར་")) | ||
|
||
# Buddha Parinirvana. | ||
self._add_buddha_parinirvana(tr("།སངས་རྒྱས་པ་རི་ནིར་ཝན།")) | ||
|
||
# Buddha's First Sermon. | ||
self._add_buddha_first_sermon(tr("སངས་རྒྱས་བཅོམ་ལྡན་འདས་ཀྱི་གསུང་ཆོས་དང་པོ།")) | ||
|
||
# Birth of Guru Rinpoche. | ||
self._add_birth_of_guru_rinpoche(tr("སྐྱབས་རྗེ་གུ་རུ་རིན་པོ་ཆེའི་འཁྲུངས་སྐར།")) | ||
|
||
# Death of Zhabdrung. | ||
self._add_death_of_zhabdrung(tr("ཞབས་དྲུང་གི་འདས་དུས།")) | ||
|
||
# Dashain. | ||
self._add_dashain(tr("དྲང་བའི་བདུད་རྩིའི་ཉིམ།")) |
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 recommend to arrange Tibetan calendar holidays in chronological order. And their tests accordingly.
def test_losar(self): | ||
self.assertHolidayName("ལལོ་གསར་", ("2022-03-03", "2024-02-11", "2025-02-28")) | ||
|
||
def test_blessed_rainy_day(self): | ||
self.assertHolidayName("ཁྲུས་འབབས་ཀྱི་ཉིནམ།", ("2022-09-23", "2024-09-23", "2025-09-23")) | ||
|
||
def test_dashain(self): | ||
self.assertHolidayName("དྲང་བའི་བདུད་རྩིའི་ཉིམ།", ("2022-10-05", "2024-10-12", "2025-10-02")) |
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.
Need to check latest 5-6 years. And check for name presence in whole years range.
"""Bhutan holidays. | ||
|
||
References: | ||
* <https://www.wipo.int/wipolex/en/legislation/details/16762> |
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.
Law of Ukraine No. 959-XII of April 16, 1991, on Foreign Economic Activities? 🙄
|
||
References: | ||
* <https://www.wipo.int/wipolex/en/legislation/details/16762> | ||
* <https://www.bhutan.travel/travel-guide/bhutanese-holidays-and-festivals> |
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.
404 error and page has not archived by Wayback Machine.
# King's Birthday (Day 1). | ||
self._add_holiday_feb_21(tr("རྒྱལ་པོའི་འཁྲུངས་སྐར།༼ཉིན༡༽།")) | ||
|
||
# King's Birthday (Day 2). | ||
self._add_holiday_feb_22(tr("རྒྱལ་པོའི་འཁྲུངས་སྐར།༼ཉིནམ་གཉིས་པ།༽")) | ||
|
||
# King's Birthday (Day 3). | ||
self._add_holiday_feb_23(tr("རྒྱལ་པོའི་འཁྲུངས་སྐར།༼ཉིན་གསུམ་པ།༽")) |
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.
Fifth Druk Gyalpo ascended the throne on 9 December 2006 and was crowned on 6 November 2008. So this holiday began to be celebrated around that time.
# Nyilo. | ||
self._add_holiday_jan_2(tr("ཉི་ལོག་")) |
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.
This holiday is obviously celebrated according to some traditional solar calendar, so it does not always fall on January 2 in the Gregorian calendar.
def __init__(self, *args, **kwargs): | ||
TibetanCalendarHolidays.__init__(self) | ||
super().__init__(*args, **kwargs) | ||
|
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.
What is the source of the Dzongkha holiday names?
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.
Can we rely on these sources :-
- GUIDE TO OFFICIAL DZONGKHA ROMANIZATION
- A classified lexicon of Standard Dzongkha
- List of Holidays 2024
- List of Holidays (2025)
- PHPA-II HOLIDAY LIST 2025
- Dzongkha Translation Services
- Dzongkha English Dictionary Online
- Behind the Name - the etymology and history of first names
- Dzongkha (Bhutanese) Translation Services
I'm closing this due to a missed deadline. Feel free to reopen if you have a ready for review code. |
Added Holidays for Bhutan along with the Tibetan Calendar and Group.
Resolves #1156 .
holidays
functionality in general)Checklist
make check
, all checks and tests are green