-
-
Notifications
You must be signed in to change notification settings - Fork 554
Add Canary Islands holidays #2971
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 Canary Islands (IC) as a new subdivision country entry (start year 1983) with module, registry export, locale PO files (en_US, es, uk), README update, tests, and a minor type annotation change in Spain; also adds a contributor entry. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (5)
🧰 Additional context used🧠 Learnings (21)📚 Learning: 2025-06-28T10:39:19.185Z
Applied to files:
📚 Learning: 2025-09-26T13:58:49.363Z
Applied to files:
📚 Learning: 2025-06-11T18:32:25.595Z
Applied to files:
📚 Learning: 2025-06-10T12:17:58.880Z
Applied to files:
📚 Learning: 2025-09-26T14:03:00.986Z
Applied to files:
📚 Learning: 2025-03-30T18:25:07.087Z
Applied to files:
📚 Learning: 2025-05-06T15:25:44.333Z
Applied to files:
📚 Learning: 2025-07-04T08:53:54.102Z
Applied to files:
📚 Learning: 2025-04-05T04:47:27.213Z
Applied to files:
📚 Learning: 2025-04-05T04:29:38.042Z
Applied to files:
📚 Learning: 2025-08-08T14:37:03.045Z
Applied to files:
📚 Learning: 2025-09-18T03:19:23.722Z
Applied to files:
📚 Learning: 2025-05-06T21:07:11.577Z
Applied to files:
📚 Learning: 2025-08-24T13:01:51.370Z
Applied to files:
📚 Learning: 2025-06-16T15:48:48.680Z
Applied to files:
📚 Learning: 2025-08-20T19:46:15.625Z
Applied to files:
📚 Learning: 2025-04-05T04:50:40.752Z
Applied to files:
📚 Learning: 2025-06-18T17:01:58.067Z
Applied to files:
📚 Learning: 2025-06-18T17:01:58.067Z
Applied to files:
📚 Learning: 2025-09-03T14:05:10.592Z
Applied to files:
📚 Learning: 2025-04-05T06:49:06.217Z
Applied to files:
🧬 Code graph analysis (2)holidays/countries/canary_islands.py (2)
tests/countries/test_canary_islands.py (2)
🔇 Additional comments (7)
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.2)holidays/countries/canary_islands.py�[1;31mruff failed�[0m tests/countries/test_canary_islands.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 |
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
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
holidays/locale/uk/LC_MESSAGES/IC.po (1)
1-29
: Missing translation entries for Ukrainian locale.The file contains only the PO header with no
msgid
/msgstr
translation pairs. However,tests/countries/test_canary_islands.py
lines 96-111 (test_l10n_uk
) expect specific Ukrainian translations like "Новий рік", "Богоявлення", etc. Without the translation entries in this file, the Ukrainian localization will fail.You need to add the complete set of holiday translation entries. Based on the test expectations, the file should include entries like:
+"X-Source-Language: es\n" + +#. New Year's Day +msgid "Año Nuevo" +msgstr "Новий рік" + +#. Epiphany +msgid "Epifanía del Señor" +msgstr "Богоявлення" + +#. Maundy Thursday +msgid "Jueves Santo" +msgstr "Великий четвер" + +#. Good Friday +msgid "Viernes Santo" +msgstr "Страсна пʼятниця" + +#. Labor Day +msgid "Fiesta del Trabajo" +msgstr "День праці" + +#. Day of the Canary Islands +msgid "Día de Canarias" +msgstr "День Канарських островів" + +#. Assumption Day +msgid "Asunción de la Virgen" +msgstr "Внебовзяття Пресвятої Діви Марії" + +#. National Day +msgid "Fiesta Nacional de España" +msgstr "Національний день Іспанії" + +#. All Saints' Day +msgid "Todos los Santos" +msgstr "День усіх святих" + +#. Constitution Day +msgid "Día de la Constitución Española" +msgstr "День Конституції Іспанії" + +#. Immaculate Conception +msgid "Inmaculada Concepción" +msgstr "Непорочне зачаття Діви Марії" + +#. Christmas Day +msgid "Natividad del Señor" +msgstr "Різдво Христове"holidays/locale/en_US/LC_MESSAGES/IC.po (1)
1-29
: Missing translation entries for en_US locale.The file contains only the PO header with no
msgid
/msgstr
translation pairs. However,tests/countries/test_canary_islands.py
lines 79-94 (test_l10n_en_us
) expect specific English translations like "New Year's Day", "Epiphany", etc. Without the translation entries in this file, the en_US localization will fail.Add the complete set of holiday translation entries based on the test expectations:
+"X-Source-Language: es\n" + +#. New Year's Day +msgid "Año Nuevo" +msgstr "New Year's Day" + +#. Epiphany +msgid "Epifanía del Señor" +msgstr "Epiphany" + +#. Maundy Thursday +msgid "Jueves Santo" +msgstr "Maundy Thursday" + +#. Good Friday +msgid "Viernes Santo" +msgstr "Good Friday" + +#. Labor Day +msgid "Fiesta del Trabajo" +msgstr "Labor Day" + +#. Day of the Canary Islands +msgid "Día de Canarias" +msgstr "Day of the Canary Islands" + +#. Assumption Day +msgid "Asunción de la Virgen" +msgstr "Assumption Day" + +#. National Day +msgid "Fiesta Nacional de España" +msgstr "National Day" + +#. All Saints' Day +msgid "Todos los Santos" +msgstr "All Saints' Day" + +#. Constitution Day +msgid "Día de la Constitución Española" +msgstr "Constitution Day" + +#. Immaculate Conception +msgid "Inmaculada Concepción" +msgstr "Immaculate Conception" + +#. Christmas Day +msgid "Natividad del Señor" +msgstr "Christmas Day"
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (10)
CONTRIBUTORS
(1 hunks)README.md
(2 hunks)holidays/countries/__init__.py
(1 hunks)holidays/countries/canary_islands.py
(1 hunks)holidays/countries/spain.py
(1 hunks)holidays/locale/en_US/LC_MESSAGES/IC.po
(1 hunks)holidays/locale/es/LC_MESSAGES/IC.po
(1 hunks)holidays/locale/uk/LC_MESSAGES/IC.po
(1 hunks)holidays/registry.py
(1 hunks)tests/countries/test_canary_islands.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (16)
📚 Learning: 2025-06-28T10:39:19.185Z
Learnt from: KJhellico
PR: vacanza/holidays#2684
File: holidays/locale/it/LC_MESSAGES/SM.po:13-13
Timestamp: 2025-06-28T10:39:19.185Z
Learning: In the holidays project, .po file header comments use the format "# [Country] holidays." for default language files (without trailing hash) and "# [Country] holidays [locale] localization." for non-default language files (also without trailing hash).
Applied to files:
holidays/locale/es/LC_MESSAGES/IC.po
holidays/locale/en_US/LC_MESSAGES/IC.po
📚 Learning: 2025-09-26T13:58:49.350Z
Learnt from: KJhellico
PR: vacanza/holidays#2960
File: holidays/locale/ca/LC_MESSAGES/ES.po:148-151
Timestamp: 2025-09-26T13:58:49.350Z
Learning: In the holidays project, when translating holiday names in .po files, the msgstr should be a faithful translation of the original msgid (in the country's default language), not influenced by English commentary or common en_US names. For example, "Día de la Pascua Granada" (Spanish) correctly translates to "Dia de la Pasqua Granada" (Catalan), even though the English comment refers to it as "Whit Monday".
Applied to files:
holidays/locale/es/LC_MESSAGES/IC.po
holidays/locale/en_US/LC_MESSAGES/IC.po
holidays/locale/uk/LC_MESSAGES/IC.po
📚 Learning: 2025-08-08T14:37:03.045Z
Learnt from: KJhellico
PR: vacanza/holidays#2774
File: tests/countries/test_liberia.py:15-16
Timestamp: 2025-08-08T14:37:03.045Z
Learning: In holidays/countries/__init__.py, re-export country classes using absolute imports (e.g., 'from holidays.countries.liberia import Liberia, LR, LBR') and keep alphabetical ordering (e.g., Lesotho, Liberia, Libya). Avoid relative imports in this file.
Applied to files:
holidays/countries/__init__.py
📚 Learning: 2025-08-08T14:37:03.045Z
Learnt from: KJhellico
PR: vacanza/holidays#2774
File: tests/countries/test_liberia.py:15-16
Timestamp: 2025-08-08T14:37:03.045Z
Learning: When adding a new country in vacanza/holidays, also re-export it in holidays/countries/__init__.py (e.g., from .liberia import Liberia, LR, LBR) so tests and users can import from holidays.countries consistently.
Applied to files:
holidays/countries/__init__.py
📚 Learning: 2025-08-09T18:31:23.218Z
Learnt from: KJhellico
PR: vacanza/holidays#2778
File: tests/countries/test_kiribati.py:15-15
Timestamp: 2025-08-09T18:31:23.218Z
Learning: In the holidays project test files, the standard import pattern is `from holidays.countries.<country> import Country, CODE1, CODE2` (used in ~97% of test files), not `from holidays.countries import Country, CODE1, CODE2`. Only a few exceptions (Suriname, Sierra Leone, Mauritius, Mali, Ivory Coast, Guyana) use the aggregated import pattern.
Applied to files:
holidays/countries/__init__.py
📚 Learning: 2025-04-18T21:13:55.589Z
Learnt from: KJhellico
PR: vacanza/holidays#2483
File: holidays/registry.py:177-177
Timestamp: 2025-04-18T21:13:55.589Z
Learning: In the holidays/registry.py file, COUNTRIES dictionary entries should use the class name (without spaces) as the first element of the tuple (e.g., "TurksAndCaicosIslands"), not the human-readable country name with spaces.
Applied to files:
holidays/registry.py
📚 Learning: 2025-07-10T11:00:13.195Z
Learnt from: KJhellico
PR: vacanza/holidays#2623
File: README.md:0-0
Timestamp: 2025-07-10T11:00:13.195Z
Learning: The COUNTRIES dictionary in holidays/registry.py contains 211 entries as confirmed by KJhellico in PR #2623, not 214 as previously calculated.
Applied to files:
holidays/registry.py
📚 Learning: 2025-03-30T18:25:07.087Z
Learnt from: KJhellico
PR: vacanza/holidays#2388
File: holidays/locale/en_CI/LC_MESSAGES/CI.po:88-88
Timestamp: 2025-03-30T18:25:07.087Z
Learning: In the holidays library, localization files have a specific structure: message comments are in standard English (en_US) describing the holiday, while actual translations (msgstr) should use the locale-specific terminology (e.g., en_CI for Ivory Coast English). For example, "Night of Power" in standard English is translated as "Lailatou-Kadr" in Ivory Coast English.
Applied to files:
holidays/locale/en_US/LC_MESSAGES/IC.po
holidays/locale/uk/LC_MESSAGES/IC.po
📚 Learning: 2025-05-06T15:25:44.333Z
Learnt from: KJhellico
PR: vacanza/holidays#2530
File: holidays/locale/ca/LC_MESSAGES/AD.po:31-40
Timestamp: 2025-05-06T15:25:44.333Z
Learning: In the Holidays project, msgid fields in localization files contain strings in the entity's default language (as defined by default_language attribute), not English source strings as in standard gettext implementations.
Applied to files:
holidays/locale/en_US/LC_MESSAGES/IC.po
📚 Learning: 2025-07-12T20:54:28.749Z
Learnt from: KJhellico
PR: vacanza/holidays#2719
File: README.md:108-108
Timestamp: 2025-07-12T20:54:28.749Z
Learning: In PR #2719 adding Faroe Islands, KJhellico confirmed that the country count in README.md should be updated from 213 to 214, making 214 the accurate total after this addition.
Applied to files:
README.md
📚 Learning: 2025-04-05T04:47:27.213Z
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.
Applied to files:
tests/countries/test_canary_islands.py
📚 Learning: 2025-04-05T04:29:38.042Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:85-86
Timestamp: 2025-04-05T04:29:38.042Z
Learning: For testing holiday implementations in the vacanza/holidays repository, recommend using `from tests.common import CommonCountryTests` as the base class instead of directly using `unittest.TestCase` to maintain consistency with project conventions and leverage common test utilities.
Applied to files:
tests/countries/test_canary_islands.py
📚 Learning: 2025-09-18T03:19:23.722Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_algeria.py:28-30
Timestamp: 2025-09-18T03:19:23.722Z
Learning: In the vacanza/holidays project, tests now use self.start_year and self.end_year from the TestCase class instead of country-specific aliases (like DZ.start_year) for start_year and end_year references. This approach provides the test framework with better control over test year ranges rather than being tied to specific country start years.
Applied to files:
tests/countries/test_canary_islands.py
📚 Learning: 2025-04-05T06:49:06.217Z
Learnt from: PPsyrius
PR: vacanza/holidays#2386
File: tests/countries/test_nepal.py:499-536
Timestamp: 2025-04-05T06:49:06.217Z
Learning: In the holidays project, test files follow a dual testing approach: individual methods test specific holidays across multiple years, while comprehensive year-specific tests (e.g., `test_2025`) verify all holidays for a specific year in a single assertion. Both approaches serve different testing purposes and complement each other.
Applied to files:
tests/countries/test_canary_islands.py
📚 Learning: 2025-04-05T04:50:40.752Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:31-49
Timestamp: 2025-04-05T04:50:40.752Z
Learning: For Turkmenistan holiday tests, use this class structure: `class TestTurkmenistan(CommonCountryTests, TestCase)` with imports `from unittest import TestCase`, `from holidays.countries import Turkmenistan, TM, TKM`, and `from tests.common import CommonCountryTests`. Ensure to call `super().setUp()` in the setUp method.
Applied to files:
tests/countries/test_canary_islands.py
📚 Learning: 2025-05-06T21:07:11.577Z
Learnt from: KJhellico
PR: vacanza/holidays#2530
File: tests/countries/test_andorra.py:23-28
Timestamp: 2025-05-06T21:07:11.577Z
Learning: In the holidays project, test methods for country holidays follow a standard form where year ranges are explicitly recreated in each test method rather than being stored as class variables, to maintain consistency across all country tests.
Applied to files:
tests/countries/test_canary_islands.py
🧬 Code graph analysis (3)
holidays/countries/canary_islands.py (2)
holidays/countries/spain.py (1)
Spain
(26-734)holidays/mixins/child_entity.py (1)
ChildEntity
(19-43)
holidays/countries/__init__.py (1)
holidays/countries/canary_islands.py (3)
CanaryIslands
(36-37)IC
(40-41)HolidaysIC
(17-33)
tests/countries/test_canary_islands.py (2)
tests/common.py (5)
TestCase
(31-370)assertAliases
(124-133)assertNoHolidays
(324-326)assertHolidays
(231-233)assertLocalizedHolidays
(359-370)holidays/countries/canary_islands.py (3)
HolidaysIC
(17-33)IC
(40-41)CanaryIslands
(36-37)
🔇 Additional comments (15)
CONTRIBUTORS (1)
24-24
: LGTM!The contributor addition is correctly placed alphabetically and follows the project's naming conventions.
holidays/countries/spain.py (1)
80-100
: LGTM!The type annotation adds clarity to the subdivisions attribute without changing runtime behavior. This is a clean improvement that aids static type checking.
holidays/registry.py (1)
63-63
: LGTM!The registry entry follows the project's conventions correctly. The class name uses PascalCase without spaces, and the alphabetical placement between Canada and Cayman Islands is accurate.
README.md (2)
108-108
: LGTM!The country count is correctly incremented from 245 to 246.
430-435
: LGTM!The Canary Islands entry is well-formed and correctly positioned alphabetically. The subdivision note clearly indicates the relationship with Spain (ES, subdivision CN), and the language specification with es as default is consistent with project conventions.
tests/countries/test_canary_islands.py (5)
19-22
: LGTM! Standard test class structure.Follows the project convention of inheriting from
CommonCountryTests
andTestCase
, with propersetUpClass
initialization.
24-25
: LGTM! Alias validation is correct.Properly validates the three class aliases (HolidaysIC, IC, CanaryIslands) using the standard
assertAliases
helper.
27-28
: LGTM! Pre-start-year validation is correct.Properly tests that year 1982 (before start_year 1983) has no holidays.
63-111
: LGTM! Localization tests follow standard patterns.The three localization tests properly validate holiday names across the supported languages (es, en_US, uk). However, these tests depend on complete translation entries in the corresponding
.po
files, which appear to be missing (see comments on locale files).
47-61
: No change required: in 2025 the Fiesta Nacional (12 Oct) in the Canary Islands is omitted—since it falls on a Sunday—and May 30 is used as the substitute holiday, so the 11-entry list is correct.holidays/countries/__init__.py (1)
55-55
: LGTM! Import follows project conventions.The import is correctly placed in alphabetical order between Canada and Cayman Islands, uses the absolute import pattern, and exports all three aliases (CanaryIslands, IC, HolidaysIC).
holidays/countries/canary_islands.py (4)
13-14
: LGTM! Imports are correct.Both imports are necessary: Spain as the parent entity and ChildEntity for the subdivision mixin pattern.
17-33
: LGTM! Well-structured class definition.The class properly uses the ChildEntity mixin pattern to establish Canary Islands as a Spanish subdivision (CN) with its own ISO 3166-1 country code (IC). Metadata is complete and accurate:
- start_year aligns with test coverage
- language support matches the provided locale files
- references provide helpful context
36-37
: LGTM! Standard alias pattern.Provides a descriptive class name alias for HolidaysIC.
40-41
: LGTM! Standard ISO code alias.Provides the two-letter ISO 3166-1 code alias (IC) for convenient access.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2971 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 301 302 +1
Lines 17962 17974 +12
Branches 2319 2319
=========================================
+ Hits 17962 17974 +12 ☔ 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.
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.
Proposed change
Resolves #2662 .
Type of change
holidays
functionality in general)Checklist
make check
locally; all checks and tests passed.