-
-
Notifications
You must be signed in to change notification settings - Fork 564
Introduce HolidayBase::_add_multiday_holiday method
#3059
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
base: dev
Are you sure you want to change the base?
Conversation
Summary by CodeRabbit
WalkthroughAdded HolidayBase._add_multiday_holiday and replaced manual per-day loops in Mongolia, Russia, and Thailand with calls to this helper; added tests for the helper’s success and error paths. No public API signatures changed; holiday date ranges are preserved. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #3059 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 306 306
Lines 18015 18012 -3
Branches 2285 2283 -2
=========================================
- Hits 18015 18012 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PPsyrius
left a 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.
Nice QoL change - I've tried adding support for _add_multiday_holiday(date, days) as well to simplify actual usage. 🚀
32a9d24 to
8a20ad2
Compare
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)
tests/test_holiday_base.py (1)
550-585: Tests look solid; add one for non‑positive days if we validatedays.Once
_add_multiday_holidayenforcesdays > 0, include:@@ def test_add_multiday_holiday_invalid_args(self): self.hb._populate(2024) with self.assertRaises(ValueError): self.hb._add_multiday_holiday(date(2024, DEC, 1), 3) with self.assertRaises(TypeError): self.hb._add_multiday_holiday("Holiday") with self.assertRaises(TypeError): self.hb._add_multiday_holiday() + def test_add_multiday_holiday_nonpositive_days(self): + self.hb._populate(2024) + dt = self.hb._add_holiday("Holiday", (JAN, 1)) + with self.assertRaises(ValueError): + self.hb._add_multiday_holiday(dt, 0) + with self.assertRaises(ValueError): + self.hb._add_multiday_holiday(dt, -5)
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
holidays/countries/mongolia.py(1 hunks)holidays/countries/russia.py(1 hunks)holidays/countries/thailand.py(1 hunks)holidays/holiday_base.py(1 hunks)tests/test_holiday_base.py(1 hunks)
🧰 Additional context used
🧠 Learnings (54)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T21:12:07.224Z
Learning: KJhellico prefers to focus on completing and reviewing the main holiday implementation code before doing detailed reviews of the corresponding test files.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:203-208
Timestamp: 2025-05-01T19:13:44.664Z
Learning: Multiple holidays on the same date are properly handled in the holidays library. When multiple `_add_...` methods are called with different holiday names for the same date, both holidays are preserved rather than the latter overwriting the former. This happens because the `__setitem__` method in `HolidayBase` merges multiple holidays on the same date by combining their names.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: holidays/countries/mongolia.py:140-146
Timestamp: 2025-06-15T11:50:44.366Z
Learning: The holidays library doesn't currently have helper functions like `_add_holiday_span` for adding consecutive multi-day holidays. Countries like Mongolia, Thailand, and Vietnam implement multi-day holiday spans using inline loops with `_timedelta(dt, delta)` pattern.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T21:00:47.849Z
Learning: In the holidays library, Islamic holidays use dedicated methods for additional days (like `_add_eid_al_fitr_day_two`, `_add_eid_al_adha_day_two`) rather than parameters. The methods don't accept a `days` parameter - each day has its own specific method.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2483
File: holidays/countries/turks_and_caicos_islands.py:117-118
Timestamp: 2025-05-13T13:23:11.375Z
Learning: The holidays library uses `_add_christmas_day_two` method to add Boxing Day holiday, not `_add_boxing_day`.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/south_africa.py:69-75
Timestamp: 2025-09-14T07:26:25.431Z
Learning: When reviewing historical holiday implementations in the vacanza/holidays repository, trust the maintainers' research and implementation decisions for specific historical edge cases, especially when they can provide sources like Wikipedia or other historical documentation that supports unusual or complex date calculation rules during specific time periods.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: holidays/countries/cabo_verde.py:133-141
Timestamp: 2025-07-14T20:23:48.198Z
Learning: The holidays library provides helper methods `_add_holiday_2nd_sun_of_may()` and `_add_holiday_3rd_sun_of_jun()` for adding holidays on the 2nd Sunday of May and 3rd Sunday of June respectively. These methods are used across multiple country implementations including Latvia, Finland, Belarus, Malaysia, Madagascar, and Cape Verde.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_indonesia.py:221-223
Timestamp: 2025-09-28T05:42:12.777Z
Learning: In tests/countries/test_indonesia.py, the manual set inclusion checks using get_named and years_found for Lunar New Year (test_lunar_new_year) and Vesak Day (test_vesak_day) are intentional and should remain until both holidays get their own `{insert}_no_estimated` flags implemented, rather than using standard harness assertions like assertHolidayName/assertNoHolidayName.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2631
File: holidays/countries/sint_maarten.py:94-95
Timestamp: 2025-06-14T20:43:15.370Z
Learning: The `_add_*` helper methods in the holidays library (such as `_add_christmas_day_two()`, `_add_labor_day()`, etc.) don't have default holiday names, so the name parameter should always be explicitly specified when calling these methods.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2653
File: holidays/locale/th/LC_MESSAGES/TW.po:17-21
Timestamp: 2025-06-21T18:06:50.027Z
Learning: KJhellico's username includes a tilde character (~) as part of their nickname (appears as "~Jhellico" in Last-Translator headers), which is intentional formatting and not an error.
📚 Learning: 2025-06-15T11:50:44.366Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: holidays/countries/mongolia.py:140-146
Timestamp: 2025-06-15T11:50:44.366Z
Learning: The holidays library doesn't currently have helper functions like `_add_holiday_span` for adding consecutive multi-day holidays. Countries like Mongolia, Thailand, and Vietnam implement multi-day holiday spans using inline loops with `_timedelta(dt, delta)` pattern.
Applied to files:
holidays/countries/mongolia.pyholidays/holiday_base.pyholidays/countries/russia.pyholidays/countries/thailand.pytests/test_holiday_base.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.
Applied to files:
holidays/countries/mongolia.pyholidays/countries/russia.pyholidays/countries/thailand.py
📚 Learning: 2025-08-21T05:56:33.276Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2843
File: holidays/countries/burundi.py:15-16
Timestamp: 2025-08-21T05:56:33.276Z
Learning: In the holidays library, when importing Gregorian month constants from holidays.calendars.gregorian, only import the months that are actually used in the date data. For example, if Islamic holiday dates only reference JUN, JUL, SEP, OCT, then only import those specific constants rather than importing additional unused months.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.
Applied to files:
holidays/countries/mongolia.pyholidays/countries/thailand.pytests/test_holiday_base.py
📚 Learning: 2025-09-18T00:32:25.031Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2944
File: tests/countries/test_myanmar.py:32-39
Timestamp: 2025-09-18T00:32:25.031Z
Learning: Myanmar holidays implementation uses StaticHolidays with special_public_holidays for government-declared substitutions/bridging days, not ObservedHolidayBase for weekend-to-weekday shifting. Myanmar's substituted holidays are always present and don't have observed=False functionality.
Applied to files:
holidays/countries/mongolia.pyholidays/countries/thailand.py
📚 Learning: 2025-10-28T17:26:45.090Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 3026
File: holidays/countries/spain.py:189-189
Timestamp: 2025-10-28T17:26:45.090Z
Learning: In the vacanza/holidays codebase, `_populate` methods (such as `_populate_public_holidays`, `_populate_subdiv_holidays`, and subdivision-specific methods like `_populate_subdiv_XX_public_holidays`) intentionally do not include return type annotations like `-> None`. This is a consistent pattern across country implementations (e.g., Germany, United States, Spain) and should not be changed even when static analysis tools like Ruff suggest adding them.
<!-- </add_learning>
Applied to files:
holidays/countries/mongolia.pyholidays/countries/russia.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.
Applied to files:
holidays/countries/mongolia.pyholidays/countries/thailand.py
📚 Learning: 2025-06-19T02:34:18.382Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2643
File: holidays/countries/mauritius.py:144-169
Timestamp: 2025-06-19T02:34:18.382Z
Learning: Custom holiday classes that extend _CustomHinduHolidays, _CustomIslamicHolidays, _CustomBuddhistHolidays, etc. in the holidays library do not use docstrings. They follow a pattern of using only inline comments above date dictionaries, as seen in Malaysia, Singapore, UAE, and other country implementations.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-06-06T14:40:31.932Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2593
File: holidays/countries/senegal.py:66-110
Timestamp: 2025-06-06T14:40:31.932Z
Learning: In the holidays library, within the _populate_public_holidays method, holidays should be arranged by calendar type (Islamic holidays first, then Gregorian holidays) without additional type grouping comments. The organization by calendar type is sufficient and follows the project's established conventions.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-08-08T14:37:03.045Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 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/mongolia.py
📚 Learning: 2025-05-10T04:32:15.760Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: holidays/countries/finland.py:0-0
Timestamp: 2025-05-10T04:32:15.760Z
Learning: In the holidays package, detailed historical context and additional information should be added as comments at the method level or above conditional blocks, while comments directly above tr() function calls should only contain the holiday name itself (e.g., "# Independence Day.").
Applied to files:
holidays/countries/mongolia.pyholidays/countries/thailand.py
📚 Learning: 2025-05-10T04:02:13.815Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2537
File: holidays/countries/finland.py:249-253
Timestamp: 2025-05-10T04:02:13.815Z
Learning: Holiday name comments directly above tr() function calls in the holidays package should only contain the holiday name itself (e.g., "# Independence Day.") without any additional context, dates, or historical information.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-08-21T04:56:03.780Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2843
File: holidays/countries/burundi.py:63-101
Timestamp: 2025-08-21T04:56:03.780Z
Learning: In the holidays library, countries with localization support consistently use tr() wrappers around holiday names when calling _add_* methods (e.g., self._add_new_years_day(tr("Holiday Name"))). This is the established pattern across United States, Thailand, and other l10n-enabled countries, contrary to any suggestion that translation is handled internally by _add_* methods.
Applied to files:
holidays/countries/mongolia.pyholidays/holiday_base.pyholidays/countries/russia.pyholidays/countries/thailand.py
📚 Learning: 2025-09-17T15:53:16.940Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2944
File: holidays/countries/myanmar.py:108-111
Timestamp: 2025-09-17T15:53:16.940Z
Learning: In the holidays package, explanatory comments about year restrictions or policy context should be placed above conditional blocks or at method level, never directly above holiday name comments that precede tr() function calls, as this would include the explanatory text in .po localization files when running `make l10n`.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-09-18T07:01:12.236Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2942
File: holidays/countries/south_africa.py:91-98
Timestamp: 2025-09-18T07:01:12.236Z
Learning: In the holidays library South Africa implementation, inline ternary operators for holiday name selection (like "Republic Day" if self._year >= 1961 else "Union Day") are intentionally kept inline rather than extracted to separate variables, as this structure is designed in preparation for future localization (l10n) support where the contextual relationship between conditions and translatable strings needs to be preserved.
Applied to files:
holidays/countries/mongolia.pyholidays/countries/russia.pyholidays/countries/thailand.py
📚 Learning: 2025-08-19T21:22:13.125Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T21:22:13.125Z
Learning: In the holidays library, message comments directly above holiday addition methods must match the holiday name exactly without any additions, modifications, or explanatory text. For example, if the holiday name is "Eid al-Fitr Holiday", the comment should be "# Eid al-Fitr Holiday." with no extra context.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-08-21T04:51:16.449Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2843
File: holidays/countries/burundi.py:13-13
Timestamp: 2025-08-21T04:51:16.449Z
Learning: In the holidays library, country classes with localization support consistently use `from gettext import gettext as tr` import and wrap class-level attributes like `estimated_label`, `observed_label`, and `observed_estimated_label` with `tr()` calls. This is the standard library-wide practice for l10n-enabled entities and is required for proper string extraction when generating .po files.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-05-06T15:29:31.893Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2530
File: holidays/countries/andorra.py:13-14
Timestamp: 2025-05-06T15:29:31.893Z
Learning: In this codebase, `tr` imported as `from gettext import gettext as tr` is used as a message marker for extracting translatable strings when generating .po files, not just for runtime translation.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-06-16T14:08:09.492Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2635
File: holidays/countries/bhutan.py:13-16
Timestamp: 2025-06-16T14:08:09.492Z
Learning: In the holidays library, translation is performed in the `_add_holiday` methods, not at the string level. Holiday strings passed to `_add_holiday_*` methods are processed through the translation machinery within those methods, so using `tr()` or `self.tr()` wrappers is unnecessary.
Applied to files:
holidays/countries/mongolia.pyholidays/countries/russia.py
📚 Learning: 2025-08-21T04:56:03.780Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2843
File: holidays/countries/burundi.py:63-101
Timestamp: 2025-08-21T04:56:03.780Z
Learning: In the holidays library, countries with localization support DO use tr() wrappers around holiday names when calling _add_* methods. This is the correct pattern for l10n-enabled country implementations, contrary to previous learning about translation being handled internally by _add_* methods.
Applied to files:
holidays/countries/mongolia.pyholidays/countries/russia.py
📚 Learning: 2025-08-26T21:24:41.827Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2860
File: holidays/countries/burkina_faso.py:27-30
Timestamp: 2025-08-26T21:24:41.827Z
Learning: Countries in the holidays library that don't have localization support yet should use plain English strings for labels (e.g., `estimated_label = "%s (estimated)"`), while only countries with existing .po translation files should use `tr()` wrapping. Check for the presence of .po files in holidays/locale to determine if a country has localization support.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-08-26T20:10:05.288Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2834
File: holidays/financial/national_stock_exchange_of_india.py:38-44
Timestamp: 2025-08-26T20:10:05.288Z
Learning: For National Stock Exchange of India (NSE) holidays implementation, only `estimated_label = tr("%s (estimated)")` is needed for localization support. The `observed_label` and `observed_estimated_label` are not required for this financial market holidays implementation.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants like FEB, TUE, MAR, and SUN internally through parent class implementations even when these constants don't appear directly in the file.
Applied to files:
holidays/countries/mongolia.pyholidays/holiday_base.pyholidays/countries/russia.pyholidays/countries/thailand.py
📚 Learning: 2025-08-28T02:42:52.755Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.755Z
Learning: In the holidays framework, when no categories parameter is specified in a country class instantiation (e.g., `Georgia(years=2025)`), the PUBLIC category is used by default. There's no need to explicitly specify `categories=PUBLIC` or import the PUBLIC constant for such test cases.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-08-11T13:48:45.953Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2794
File: holidays/calendars/ethiopian.py:13-13
Timestamp: 2025-08-11T13:48:45.953Z
Learning: The holidays library does not use `__all__` declarations in calendar modules (holidays/calendars/). Calendar files follow a standard pattern of defining constants and functions directly without explicit exports, similar to the convention used in country modules.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-08-19T21:00:47.849Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T21:00:47.849Z
Learning: In the holidays library, Islamic holidays use dedicated methods for additional days (like `_add_eid_al_fitr_day_two`, `_add_eid_al_adha_day_two`) rather than parameters. The methods don't accept a `days` parameter - each day has its own specific method.
Applied to files:
holidays/countries/mongolia.pyholidays/holiday_base.pyholidays/countries/russia.pyholidays/countries/thailand.py
📚 Learning: 2025-07-14T20:23:48.198Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: holidays/countries/cabo_verde.py:133-141
Timestamp: 2025-07-14T20:23:48.198Z
Learning: The holidays library provides helper methods `_add_holiday_2nd_sun_of_may()` and `_add_holiday_3rd_sun_of_jun()` for adding holidays on the 2nd Sunday of May and 3rd Sunday of June respectively. These methods are used across multiple country implementations including Latvia, Finland, Belarus, Malaysia, Madagascar, and Cape Verde.
Applied to files:
holidays/countries/mongolia.pyholidays/holiday_base.py
📚 Learning: 2025-08-12T03:21:09.116Z
Learnt from: mbfarah
Repo: vacanza/holidays PR: 2798
File: holidays/countries/chile.py:278-281
Timestamp: 2025-08-12T03:21:09.116Z
Learning: In Chile holidays implementation, the general rule for September 17 (years >= 2007) uses MON_ONLY for years 2007-2016, meaning it only adds the holiday when September 17 falls on a Monday. For years when September 17 falls on other days and was declared a one-off holiday by specific laws, it must be added to the special_public_holidays dictionary.
Applied to files:
holidays/countries/mongolia.py
📚 Learning: 2025-03-19T16:54:58.657Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2354
File: holidays/countries/fiji.py:146-159
Timestamp: 2025-03-19T16:54:58.657Z
Learning: In the holidays library implementation, explicit holiday dates (like Diwali in Fiji) are only defined for historical years with official sources (2016-2025). Future dates beyond the explicitly defined range are automatically calculated by methods like `_add_diwali`, which provide approximations when official dates aren't yet available.
Applied to files:
holidays/countries/mongolia.pyholidays/countries/thailand.py
📚 Learning: 2025-06-14T20:43:15.370Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2631
File: holidays/countries/sint_maarten.py:94-95
Timestamp: 2025-06-14T20:43:15.370Z
Learning: The `_add_*` helper methods in the holidays library (such as `_add_christmas_day_two()`, `_add_labor_day()`, etc.) don't have default holiday names, so the name parameter should always be explicitly specified when calling these methods.
Applied to files:
holidays/countries/mongolia.pyholidays/holiday_base.pyholidays/countries/russia.pytests/test_holiday_base.py
📚 Learning: 2025-05-01T19:13:44.664Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:203-208
Timestamp: 2025-05-01T19:13:44.664Z
Learning: Multiple holidays on the same date are properly handled in the holidays library. When multiple `_add_...` methods are called with different holiday names for the same date, both holidays are preserved rather than the latter overwriting the former. This happens because the `__setitem__` method in `HolidayBase` merges multiple holidays on the same date by combining their names.
Applied to files:
holidays/countries/mongolia.pyholidays/holiday_base.pyholidays/countries/russia.pyholidays/countries/thailand.pytests/test_holiday_base.py
📚 Learning: 2025-08-24T06:53:35.897Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2852
File: holidays/countries/tajikistan.py:55-56
Timestamp: 2025-08-24T06:53:35.897Z
Learning: In Tajikistan, March 8th is celebrated as Mother's Day (Рӯзи Модар) rather than International Women's Day, so the country-specific implementation should use _add_holiday_mar_8() rather than the shared _add_womens_day() helper from InternationalHolidays.
Applied to files:
holidays/countries/mongolia.pyholidays/countries/thailand.py
📚 Learning: 2025-06-15T15:24:53.055Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2606
File: holidays/countries/faroe_islands.py:62-67
Timestamp: 2025-06-15T15:24:53.055Z
Learning: The `HolidayBase` class uses `__getattr__` to dynamically implement `_add_holiday_*` methods through pattern matching, including patterns like `_add_holiday_<n>_days_past_easter`, `_add_holiday_<month>_<day>`, and various weekday-relative patterns. Methods like `_add_holiday_26_days_past_easter` are not explicitly defined but are dynamically generated when called.
Applied to files:
holidays/holiday_base.pytests/test_holiday_base.py
📚 Learning: 2025-05-13T13:23:11.375Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2483
File: holidays/countries/turks_and_caicos_islands.py:117-118
Timestamp: 2025-05-13T13:23:11.375Z
Learning: The holidays library uses `_add_christmas_day_two` method to add Boxing Day holiday, not `_add_boxing_day`.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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:
holidays/holiday_base.pyholidays/countries/russia.pyholidays/countries/thailand.pytests/test_holiday_base.py
📚 Learning: 2025-05-01T19:19:42.346Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2386
File: tests/countries/test_nepal.py:551-554
Timestamp: 2025-05-01T19:19:42.346Z
Learning: In the holidays library, when multiple holidays fall on the same date, their names are always sorted alphabetically (in __setitem__ of HolidayBase), so the order of addition does not affect the resulting string.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2614
File: holidays/countries/guyana.py:78-90
Timestamp: 2025-06-13T12:18:03.539Z
Learning: The holidays codebase now uses the constructor signature pattern `__init__(self, *args, islamic_show_estimated: bool = True, **kwargs)` across country classes.
Applied to files:
holidays/holiday_base.pyholidays/countries/russia.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
holidays/countries/russia.pyholidays/countries/thailand.pytests/test_holiday_base.py
📚 Learning: 2025-11-08T05:09:56.159Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.
Applied to files:
holidays/countries/russia.pytests/test_holiday_base.py
📚 Learning: 2025-05-06T21:07:11.577Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 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:
holidays/countries/russia.py
📚 Learning: 2025-06-18T10:21:01.376Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2642
File: holidays/countries/france.py:300-319
Timestamp: 2025-06-18T10:21:01.376Z
Learning: In the France holidays implementation, legislative years for holiday changes should be hard-coded rather than extracted into constants, as this maintains consistency with the existing codebase pattern and provides historical accuracy for specific legislative acts.
Applied to files:
holidays/countries/russia.py
📚 Learning: 2025-09-28T05:42:12.777Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_indonesia.py:221-223
Timestamp: 2025-09-28T05:42:12.777Z
Learning: In tests/countries/test_indonesia.py, the manual set inclusion checks using get_named and years_found for Lunar New Year (test_lunar_new_year) and Vesak Day (test_vesak_day) are intentional and should remain until both holidays get their own `{insert}_no_estimated` flags implemented, rather than using standard harness assertions like assertHolidayName/assertNoHolidayName.
Applied to files:
holidays/countries/thailand.pytests/test_holiday_base.py
📚 Learning: 2025-09-21T05:16:38.578Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2951
File: tests/calendars/test_thai.py:0-0
Timestamp: 2025-09-21T05:16:38.578Z
Learning: In holidays/calendars/thai.py, the `buddhist_sabbath_dates` method in `_ThaiLunisolar` is independent of calendar type (THAI_CALENDAR vs KHMER_CALENDAR) and calculates Buddhist Sabbath dates consistently regardless of which calendar is being used.
Applied to files:
holidays/countries/thailand.py
📚 Learning: 2025-09-17T15:15:24.269Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2944
File: holidays/countries/myanmar.py:112-121
Timestamp: 2025-09-17T15:15:24.269Z
Learning: The Myanmar government's "continuous public days for 2024-2025" policy specifically covers Tabaung and Tazaungmon full moon days by bridging gaps with weekends, but does not apply to Myanmar New Year (Thingyan) extra days, which follow a separate policy that correctly uses `self._year >= 2024`.
Applied to files:
holidays/countries/thailand.py
📚 Learning: 2025-09-25T10:05:04.107Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2959
File: tests/countries/test_myanmar.py:398-434
Timestamp: 2025-09-25T10:05:04.107Z
Learning: In the holidays library Thai localizations, there are two distinct patterns: 1) "%s (observed)" holidays use "ชดเชย%s" format, and 2) "Day off (substituted from %s)" holidays use "วันหยุด (แทน %s)" format. These serve different purposes and should not be confused - substituted holidays are not the same as observed holidays.
Applied to files:
holidays/countries/thailand.py
📚 Learning: 2025-08-19T19:47:21.735Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2829
File: tests/countries/test_canada.py:291-296
Timestamp: 2025-08-19T19:47:21.735Z
Learning: In the holidays library, HolidayBase objects automatically populate years on-demand when expand=True (the default). When checking dates from years not initially in the years range, those years are automatically populated via the logic at line 646 in holiday_base.py: "if self.expand and dt.year not in self.years:". This means tests can check dates outside the initial year range without needing separate holiday instances.
Applied to files:
holidays/countries/thailand.pytests/test_holiday_base.py
📚 Learning: 2025-04-05T06:49:06.217Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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/test_holiday_base.py
📚 Learning: 2025-09-20T12:21:50.877Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_belgium.py:28-30
Timestamp: 2025-09-20T12:21:50.877Z
Learning: Belgium holidays implementation currently lacks a start_year attribute. In tests/countries/test_belgium.py, do not suggest adding test_no_holidays methods that rely on start_year until the start_year attribute is introduced to Belgium's holiday implementation.
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-04-05T04:29:38.042Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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/test_holiday_base.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2623
File: tests/countries/test_christmas_island.py:136-146
Timestamp: 2025-07-09T21:16:35.145Z
Learning: In Christmas Island's holiday implementation, the test_christmas_day method cannot use assertNoNonObservedHoliday because in some years observed Christmas Day overlaps with Boxing Day when both holidays are moved due to weekend conflicts, causing the standard non-observed holiday check to fail inappropriately.
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-09-03T16:49:35.246Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:375-375
Timestamp: 2025-09-03T16:49:35.246Z
Learning: In the holidays library, national holiday tests use self.full_range (or similar comprehensive year ranges) even when explicit test dates only show modern observance. This is intentional for correctness and comprehensive coverage, unlike subdivision-specific holidays which have explicit year boundaries based on known start dates.
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are properly covered by the test_eid_al_fitr_day() method, which tests both the regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.558Z
Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.
Applied to files:
tests/test_holiday_base.py
🧬 Code graph analysis (5)
holidays/countries/mongolia.py (1)
holidays/holiday_base.py (1)
_add_multiday_holiday(812-858)
holidays/holiday_base.py (1)
holidays/calendars/gregorian.py (1)
_timedelta(37-42)
holidays/countries/russia.py (2)
holidays/holiday_base.py (1)
_add_multiday_holiday(812-858)holidays/groups/international.py (1)
_add_new_years_day(142-150)
holidays/countries/thailand.py (1)
holidays/holiday_base.py (1)
_add_multiday_holiday(812-858)
tests/test_holiday_base.py (1)
holidays/holiday_base.py (5)
_populate(933-956)_populate(1462-1465)_add_multiday_holiday(812-858)_add_holiday(798-810)get_named(1047-1103)
🪛 Ruff (0.14.4)
holidays/holiday_base.py
812-812: Missing type annotation for *args
(ANN002)
848-848: Avoid specifying long messages outside the exception class
(TRY003)
850-853: Avoid specifying long messages outside the exception class
(TRY003)
tests/test_holiday_base.py
556-556: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
557-557: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
558-558: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
559-559: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
560-560: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
561-561: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
562-562: Use a regular assert instead of unittest-style assertEqual
Replace assertEqual(...) with assert ...
(PT009)
567-567: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
568-568: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
569-569: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
570-570: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
571-571: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
572-572: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
573-573: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
575-575: Use a regular assert instead of unittest-style assertEqual
Replace assertEqual(...) with assert ...
(PT009)
579-579: Use pytest.raises instead of unittest-style assertRaises
Replace assertRaises with pytest.raises
(PT027)
581-581: Use pytest.raises instead of unittest-style assertRaises
Replace assertRaises with pytest.raises
(PT027)
583-583: Use pytest.raises instead of unittest-style assertRaises
Replace assertRaises with pytest.raises
(PT027)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Test build on ubuntu-latest
- GitHub Check: Test build on macos-latest
- GitHub Check: Test build on windows-latest
🔇 Additional comments (3)
holidays/countries/thailand.py (1)
325-329: Nice swap to the helper; semantics preserved.The
(date, days)form keeps names consistent and covers Mar 28 → Apr 15 (19 total with start). In‑lieu anchor (dt) isn’t used for these years, so no impact.holidays/countries/russia.py (1)
50-50: LGTM: helper adds Jan 2–5 cleanly.
_add_multiday_holiday(self._add_new_years_day(name), 4)matches prior 1–5 expansion; Jan 6 and 8 remain intact for ≥2013.holidays/countries/mongolia.py (1)
160-163: Good consolidation with the helper.Reads better than a loop and preserves the 45‑day span after Sep 5.
PPsyrius
left a 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.
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.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
holidays/holiday_base.py(1 hunks)tests/test_holiday_base.py(1 hunks)
🧰 Additional context used
🧠 Learnings (30)
📓 Common learnings
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T21:12:07.224Z
Learning: KJhellico prefers to focus on completing and reviewing the main holiday implementation code before doing detailed reviews of the corresponding test files.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:203-208
Timestamp: 2025-05-01T19:13:44.664Z
Learning: Multiple holidays on the same date are properly handled in the holidays library. When multiple `_add_...` methods are called with different holiday names for the same date, both holidays are preserved rather than the latter overwriting the former. This happens because the `__setitem__` method in `HolidayBase` merges multiple holidays on the same date by combining their names.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: holidays/countries/mongolia.py:140-146
Timestamp: 2025-06-15T11:50:44.366Z
Learning: The holidays library doesn't currently have helper functions like `_add_holiday_span` for adding consecutive multi-day holidays. Countries like Mongolia, Thailand, and Vietnam implement multi-day holiday spans using inline loops with `_timedelta(dt, delta)` pattern.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T21:00:47.849Z
Learning: In the holidays library, Islamic holidays use dedicated methods for additional days (like `_add_eid_al_fitr_day_two`, `_add_eid_al_adha_day_two`) rather than parameters. The methods don't accept a `days` parameter - each day has its own specific method.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2483
File: holidays/countries/turks_and_caicos_islands.py:117-118
Timestamp: 2025-05-13T13:23:11.375Z
Learning: The holidays library uses `_add_christmas_day_two` method to add Boxing Day holiday, not `_add_boxing_day`.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/south_africa.py:69-75
Timestamp: 2025-09-14T07:26:25.431Z
Learning: When reviewing historical holiday implementations in the vacanza/holidays repository, trust the maintainers' research and implementation decisions for specific historical edge cases, especially when they can provide sources like Wikipedia or other historical documentation that supports unusual or complex date calculation rules during specific time periods.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_belgium.py:28-30
Timestamp: 2025-09-20T12:21:50.877Z
Learning: Belgium holidays implementation currently lacks a start_year attribute. In tests/countries/test_belgium.py, do not suggest adding test_no_holidays methods that rely on start_year until the start_year attribute is introduced to Belgium's holiday implementation.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: holidays/countries/cabo_verde.py:133-141
Timestamp: 2025-07-14T20:23:48.198Z
Learning: The holidays library provides helper methods `_add_holiday_2nd_sun_of_may()` and `_add_holiday_3rd_sun_of_jun()` for adding holidays on the 2nd Sunday of May and 3rd Sunday of June respectively. These methods are used across multiple country implementations including Latvia, Finland, Belarus, Malaysia, Madagascar, and Cape Verde.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_indonesia.py:221-223
Timestamp: 2025-09-28T05:42:12.777Z
Learning: In tests/countries/test_indonesia.py, the manual set inclusion checks using get_named and years_found for Lunar New Year (test_lunar_new_year) and Vesak Day (test_vesak_day) are intentional and should remain until both holidays get their own `{insert}_no_estimated` flags implemented, rather than using standard harness assertions like assertHolidayName/assertNoHolidayName.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2631
File: holidays/countries/sint_maarten.py:94-95
Timestamp: 2025-06-14T20:43:15.370Z
Learning: The `_add_*` helper methods in the holidays library (such as `_add_christmas_day_two()`, `_add_labor_day()`, etc.) don't have default holiday names, so the name parameter should always be explicitly specified when calling these methods.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2653
File: holidays/locale/th/LC_MESSAGES/TW.po:17-21
Timestamp: 2025-06-21T18:06:50.027Z
Learning: KJhellico's username includes a tilde character (~) as part of their nickname (appears as "~Jhellico" in Last-Translator headers), which is intentional formatting and not an error.
📚 Learning: 2025-05-01T19:13:44.664Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2386
File: holidays/countries/nepal.py:203-208
Timestamp: 2025-05-01T19:13:44.664Z
Learning: Multiple holidays on the same date are properly handled in the holidays library. When multiple `_add_...` methods are called with different holiday names for the same date, both holidays are preserved rather than the latter overwriting the former. This happens because the `__setitem__` method in `HolidayBase` merges multiple holidays on the same date by combining their names.
Applied to files:
holidays/holiday_base.pytests/test_holiday_base.py
📚 Learning: 2025-06-15T11:50:44.366Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: holidays/countries/mongolia.py:140-146
Timestamp: 2025-06-15T11:50:44.366Z
Learning: The holidays library doesn't currently have helper functions like `_add_holiday_span` for adding consecutive multi-day holidays. Countries like Mongolia, Thailand, and Vietnam implement multi-day holiday spans using inline loops with `_timedelta(dt, delta)` pattern.
Applied to files:
holidays/holiday_base.pytests/test_holiday_base.py
📚 Learning: 2025-06-15T15:24:53.055Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2606
File: holidays/countries/faroe_islands.py:62-67
Timestamp: 2025-06-15T15:24:53.055Z
Learning: The `HolidayBase` class uses `__getattr__` to dynamically implement `_add_holiday_*` methods through pattern matching, including patterns like `_add_holiday_<n>_days_past_easter`, `_add_holiday_<month>_<day>`, and various weekday-relative patterns. Methods like `_add_holiday_26_days_past_easter` are not explicitly defined but are dynamically generated when called.
Applied to files:
holidays/holiday_base.pytests/test_holiday_base.py
📚 Learning: 2025-08-19T21:00:47.849Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T21:00:47.849Z
Learning: In the holidays library, Islamic holidays use dedicated methods for additional days (like `_add_eid_al_fitr_day_two`, `_add_eid_al_adha_day_two`) rather than parameters. The methods don't accept a `days` parameter - each day has its own specific method.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-06-14T20:43:15.370Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2631
File: holidays/countries/sint_maarten.py:94-95
Timestamp: 2025-06-14T20:43:15.370Z
Learning: The `_add_*` helper methods in the holidays library (such as `_add_christmas_day_two()`, `_add_labor_day()`, etc.) don't have default holiday names, so the name parameter should always be explicitly specified when calling these methods.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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:
holidays/holiday_base.pytests/test_holiday_base.py
📚 Learning: 2025-05-13T13:23:11.375Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2483
File: holidays/countries/turks_and_caicos_islands.py:117-118
Timestamp: 2025-05-13T13:23:11.375Z
Learning: The holidays library uses `_add_christmas_day_two` method to add Boxing Day holiday, not `_add_boxing_day`.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-07-14T20:23:48.198Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2654
File: holidays/countries/cabo_verde.py:133-141
Timestamp: 2025-07-14T20:23:48.198Z
Learning: The holidays library provides helper methods `_add_holiday_2nd_sun_of_may()` and `_add_holiday_3rd_sun_of_jun()` for adding holidays on the 2nd Sunday of May and 3rd Sunday of June respectively. These methods are used across multiple country implementations including Latvia, Finland, Belarus, Malaysia, Madagascar, and Cape Verde.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-08-21T04:56:03.780Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2843
File: holidays/countries/burundi.py:63-101
Timestamp: 2025-08-21T04:56:03.780Z
Learning: In the holidays library, countries with localization support consistently use tr() wrappers around holiday names when calling _add_* methods (e.g., self._add_new_years_day(tr("Holiday Name"))). This is the established pattern across United States, Thailand, and other l10n-enabled countries, contrary to any suggestion that translation is handled internally by _add_* methods.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2614
File: holidays/countries/guyana.py:78-90
Timestamp: 2025-06-13T12:18:03.539Z
Learning: The holidays codebase now uses the constructor signature pattern `__init__(self, *args, islamic_show_estimated: bool = True, **kwargs)` across country classes.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants like FEB, TUE, MAR, and SUN internally through parent class implementations even when these constants don't appear directly in the file.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-04-23T09:59:19.886Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2490
File: holidays/countries/ethiopia.py:45-45
Timestamp: 2025-04-23T09:59:19.886Z
Learning: For the Ethiopia holidays class, it's appropriate to add a return type hint only to the `_is_leap_year` method to match the base class implementation in `holidays/holiday_base.py`, while keeping other methods without type hints to maintain consistency with other country implementations.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-04-03T12:36:41.201Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2398
File: holidays/countries/guinea.py:73-77
Timestamp: 2025-04-03T12:36:41.201Z
Learning: In the Holidays library, comments explaining year restrictions for holidays should be placed above the year check conditional statement, not inside it. Example format:
```python
# reason why goes here
if start_year <= self._year <= end_year:
# Holiday name
self._add_holiday_function(tr("Holiday Name"))
```
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.
Applied to files:
holidays/holiday_base.pytests/test_holiday_base.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_paraguay.py:134-139
Timestamp: 2025-09-17T09:07:56.459Z
Learning: In the vacanza/holidays project, for holidays that start from a specific year (not the country's start_year), the standard pattern is to use `range(specific_year, self.end_year)` rather than `self.full_range` with year conditions. This maintains consistency across the codebase and clearly separates the holiday period from the pre-holiday period using `assertNoHolidayName(name, range(self.start_year, specific_year))`.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-09-16T09:44:45.875Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: holidays/countries/hungary.py:46-49
Timestamp: 2025-09-16T09:44:45.875Z
Learning: In the holidays library, using generic variable names like `name` for holiday names within country implementations is acceptable and follows established patterns across other country files, even when the same variable name might be reused for different holidays within the same method.
Applied to files:
holidays/holiday_base.py
📚 Learning: 2025-04-05T06:49:06.217Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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/test_holiday_base.py
📚 Learning: 2025-11-08T05:09:56.159Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-04-05T04:29:38.042Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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/test_holiday_base.py
📚 Learning: 2025-09-20T12:21:50.877Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_belgium.py:28-30
Timestamp: 2025-09-20T12:21:50.877Z
Learning: Belgium holidays implementation currently lacks a start_year attribute. In tests/countries/test_belgium.py, do not suggest adding test_no_holidays methods that rely on start_year until the start_year attribute is introduced to Belgium's holiday implementation.
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-09-18T03:19:23.722Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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/test_holiday_base.py
📚 Learning: 2025-09-28T05:42:12.777Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_indonesia.py:221-223
Timestamp: 2025-09-28T05:42:12.777Z
Learning: In tests/countries/test_indonesia.py, the manual set inclusion checks using get_named and years_found for Lunar New Year (test_lunar_new_year) and Vesak Day (test_vesak_day) are intentional and should remain until both holidays get their own `{insert}_no_estimated` flags implemented, rather than using standard harness assertions like assertHolidayName/assertNoHolidayName.
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2623
File: tests/countries/test_christmas_island.py:136-146
Timestamp: 2025-07-09T21:16:35.145Z
Learning: In Christmas Island's holiday implementation, the test_christmas_day method cannot use assertNoNonObservedHoliday because in some years observed Christmas Day overlaps with Boxing Day when both holidays are moved due to weekend conflicts, causing the standard non-observed holiday check to fail inappropriately.
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-09-03T16:49:35.246Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:375-375
Timestamp: 2025-09-03T16:49:35.246Z
Learning: In the holidays library, national holiday tests use self.full_range (or similar comprehensive year ranges) even when explicit test dates only show modern observance. This is intentional for correctness and comprehensive coverage, unlike subdivision-specific holidays which have explicit year boundaries based on known start dates.
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are properly covered by the test_eid_al_fitr_day() method, which tests both the regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-08-19T19:47:21.735Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2829
File: tests/countries/test_canada.py:291-296
Timestamp: 2025-08-19T19:47:21.735Z
Learning: In the holidays library, HolidayBase objects automatically populate years on-demand when expand=True (the default). When checking dates from years not initially in the years range, those years are automatically populated via the logic at line 646 in holiday_base.py: "if self.expand and dt.year not in self.years:". This means tests can check dates outside the initial year range without needing separate holiday instances.
Applied to files:
tests/test_holiday_base.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.558Z
Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.
Applied to files:
tests/test_holiday_base.py
🧬 Code graph analysis (2)
holidays/holiday_base.py (1)
holidays/calendars/gregorian.py (1)
_timedelta(37-42)
tests/test_holiday_base.py (1)
holidays/holiday_base.py (5)
_populate(917-940)_populate(1446-1449)_add_multiday_holiday(812-842)_add_holiday(798-810)get_named(1031-1087)
🪛 Ruff (0.14.4)
holidays/holiday_base.py
836-836: Avoid specifying long messages outside the exception class
(TRY003)
tests/test_holiday_base.py
555-555: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
556-556: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
557-557: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
558-558: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
559-559: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
560-560: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
561-561: Use a regular assert instead of unittest-style assertEqual
Replace assertEqual(...) with assert ...
(PT009)
565-565: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
566-566: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
567-567: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
568-568: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
569-569: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
570-570: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
571-571: Use a regular assert instead of unittest-style assertIn
Replace assertIn(...) with assert ...
(PT009)
573-573: Use a regular assert instead of unittest-style assertEqual
Replace assertEqual(...) with assert ...
(PT009)
577-577: Use pytest.raises instead of unittest-style assertRaises
Replace assertRaises with pytest.raises
(PT027)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Test Python 3.13 on windows-latest
- GitHub Check: Test Python 3.14 on windows-latest
- GitHub Check: Test Python 3.10 on windows-latest
🔇 Additional comments (2)
tests/test_holiday_base.py (2)
550-574: Test coverage looks solid for the happy paths.The tests clearly demonstrate the expected usage pattern where
_add_holidayis called first to establish the start_date, then_add_multiday_holidayextends the holiday period. The verification using both date checks andget_namedcounts is thorough.
575-579: Consider adding edge case test for non-positive duration_days.The error handling test covers the case where the start_date doesn't exist in the calendar, which is good. However, you might want to add a test for
duration_days <= 0to verify the expected behavior (silent no-op vs ValueError).That said, I note from past comments that KJhellico considers such validation excessive for internal methods, so this is optional.
⛔ Skipped due to learnings
Learnt from: KJhellico Repo: vacanza/holidays PR: 2608 File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178 Timestamp: 2025-07-02T18:17:53.342Z Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.Learnt from: PPsyrius Repo: vacanza/holidays PR: 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.Learnt from: PPsyrius Repo: vacanza/holidays PR: 2881 File: tests/countries/test_french_polynesia.py:19-22 Timestamp: 2025-11-08T05:09:56.159Z Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.Learnt from: PPsyrius Repo: vacanza/holidays PR: 2881 File: tests/countries/test_belgium.py:28-30 Timestamp: 2025-09-20T12:21:50.877Z Learning: Belgium holidays implementation currently lacks a start_year attribute. In tests/countries/test_belgium.py, do not suggest adding test_no_holidays methods that rely on start_year until the start_year attribute is introduced to Belgium's holiday implementation.Learnt from: PPsyrius Repo: vacanza/holidays PR: 2881 File: tests/countries/test_iran.py:28-28 Timestamp: 2025-09-14T16:05:55.205Z Learning: In tests/countries/test_iran.py, using years=(self.start_year - 1, 2102) in the no-holiday test is intentional because Iran uses the Persian Calendar which has specific supported year range constraints, and 2102 represents the upper limit of the Persian Calendar's supported range, not just an arbitrary far-future date.Learnt from: PPsyrius Repo: vacanza/holidays PR: 2881 File: tests/countries/test_barbados.py:21-23 Timestamp: 2025-09-14T16:03:13.558Z Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.Learnt from: PPsyrius Repo: vacanza/holidays PR: 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.Learnt from: PPsyrius Repo: vacanza/holidays PR: 2881 File: tests/countries/test_brazil.py:28-30 Timestamp: 2025-09-10T14:35:54.603Z Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.Learnt from: PPsyrius Repo: vacanza/holidays PR: 2750 File: tests/countries/test_germany.py:46-46 Timestamp: 2025-07-24T15:21:31.632Z Learning: In the holidays project test files, the standard method name for testing the absence of holidays is `test_no_holidays`, not more descriptive names like `test_no_holidays_before_1990`. This is a consistent naming convention across country test files like France and Germany.Learnt from: PPsyrius Repo: vacanza/holidays PR: 2750 File: tests/countries/test_germany.py:46-46 Timestamp: 2025-07-24T15:21:31.632Z Learning: In the holidays project test files, the standard method name for testing the absence of holidays is `test_no_holidays`, not more descriptive names like `test_no_holidays_before_1990`. This is a consistent naming convention across country test files like France and Germany.Learnt from: KJhellico Repo: vacanza/holidays PR: 2623 File: tests/countries/test_christmas_island.py:136-146 Timestamp: 2025-07-09T21:16:35.145Z Learning: In Christmas Island's holiday implementation, the test_christmas_day method cannot use assertNoNonObservedHoliday because in some years observed Christmas Day overlaps with Boxing Day when both holidays are moved due to weekend conflicts, causing the standard non-observed holiday check to fail inappropriately.Learnt from: PPsyrius Repo: vacanza/holidays PR: 2601 File: holidays/countries/mongolia.py:140-146 Timestamp: 2025-06-15T11:50:44.366Z Learning: The holidays library doesn't currently have helper functions like `_add_holiday_span` for adding consecutive multi-day holidays. Countries like Mongolia, Thailand, and Vietnam implement multi-day holiday spans using inline loops with `_timedelta(dt, delta)` pattern.Learnt from: KJhellico Repo: vacanza/holidays PR: 2820 File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:76-76 Timestamp: 2025-09-03T18:29:09.398Z Learning: The assertNoNonObservedHoliday method in tests/common.py accepts a holidays object as its first parameter, followed by the dates to check. Usage like assertNoNonObservedHoliday(self.government_holidays_non_observed, obs_dt) is correct and intended behavior.Learnt from: PPsyrius Repo: vacanza/holidays PR: 2881 File: tests/countries/test_bosnia_and_herzegovina.py:21-24 Timestamp: 2025-09-10T16:17:30.428Z Learning: Bosnia and Herzegovina holidays implementation currently lacks a start_year attribute. In tests/countries/test_bosnia_and_herzegovina.py, using cls.full_range = range(2000, 2050) is intentional to bound assertions and setup. Do not suggest replacing it with harness default full_range until start_year is introduced.Learnt from: KJhellico Repo: vacanza/holidays PR: 2386 File: holidays/countries/nepal.py:203-208 Timestamp: 2025-05-01T19:13:44.664Z Learning: Multiple holidays on the same date are properly handled in the holidays library. When multiple `_add_...` methods are called with different holiday names for the same date, both holidays are preserved rather than the latter overwriting the former. This happens because the `__setitem__` method in `HolidayBase` merges multiple holidays on the same date by combining their names.



Proposed change
Some countries have holidays that last multiple days. I suggest adding the
HolidayBase::_add_multiday_holidaymethod, which adds a specified number of holiday days starting from the day after the specified date. It would be great to add the whole holiday, from day one, but I haven't found a good way to integrate this into existing mechanism. I hope someone might offer some suggestions. :)Type of change
holidaysfunctionality in general)Checklist
make checklocally; all checks and tests passed.