-
-
Notifications
You must be signed in to change notification settings - Fork 554
TestCase Syntactic Sugar Support #2881
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
WalkthroughRefactors the test harness to build cached subdivision/category lookups and install generated per-variant assertion methods, then updates hundreds of tests to use dynamic year ranges, per-category supported_categories, observed/non-observed variants, and year-scoped country instances. Changes
Estimated code review effort🎯 5 (Critical) | ⏱️ ~150+ minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 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 |
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)
tests/common.py (2)
45-50
: Fix default_language length check (logic bug).The current condition
2 > len > 6
can never be true. Use a proper range check.Apply this diff:
- if ( - getattr(test_class, "default_language") is not None - # Normally 2-6 letters (e.g., en, pap, en_US, pap_AW). - and 2 > len(test_class.default_language) > 6 - ): + if ( + getattr(test_class, "default_language") is not None + # Normally 2-6 letters (e.g., en, pap, en_US, pap_AW). + and not (2 <= len(test_class.default_language) <= 6) + ): raise ValueError(f"`{test_class.__name__}.default_language` value is invalid.")
541-551
: Potential brittleness in observed_rule detection.Using
.values()
assumes observed_rule is dict-like. Some entities expose an ObservedRule object. Consider guarding for non-mapping types to avoid AttributeError.Apply this defensive tweak:
- and any( - rule is not None for rule in getattr(self.holidays, "observed_rule", {}).values() - ) + and any( + getattr(getattr(self.holidays, "observed_rule", {}), "values", lambda: [])() + )
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
tests/common.py
(11 hunks)tests/countries/test_taiwan.py
(21 hunks)tests/financial/test_national_stock_exchange_of_india.py
(6 hunks)
🧰 Additional context used
🧠 Learnings (29)
📓 Common learnings
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
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.
Learnt from: KJhellico
PR: vacanza/holidays#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
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.
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
📚 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/financial/test_national_stock_exchange_of_india.py
tests/countries/test_taiwan.py
tests/common.py
📚 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/financial/test_national_stock_exchange_of_india.py
tests/countries/test_taiwan.py
tests/common.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/financial/test_national_stock_exchange_of_india.py
tests/countries/test_taiwan.py
tests/common.py
📚 Learning: 2025-08-26T20:10:05.288Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/financial/test_national_stock_exchange_of_india.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
tests/financial/test_national_stock_exchange_of_india.py
tests/common.py
📚 Learning: 2025-08-30T12:52:58.513Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:52:58.513Z
Learning: In the NSE holidays implementation, assertLocalizedHolidays should only include holidays that are actually observed (trading holidays), not holidays that fall on weekends and are excluded by the observed_rule. For example, Eid al-Fitr 2023 falls on Saturday and is correctly excluded from localization tests.
Applied to files:
tests/financial/test_national_stock_exchange_of_india.py
📚 Learning: 2025-05-09T18:36:09.607Z
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Applied to files:
tests/financial/test_national_stock_exchange_of_india.py
📚 Learning: 2025-04-23T14:55:35.504Z
Learnt from: PPsyrius
PR: vacanza/holidays#2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.
Applied to files:
tests/financial/test_national_stock_exchange_of_india.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
Applied to files:
tests/financial/test_national_stock_exchange_of_india.py
tests/countries/test_taiwan.py
tests/common.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
PR: vacanza/holidays#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/financial/test_national_stock_exchange_of_india.py
tests/countries/test_taiwan.py
tests/common.py
📚 Learning: 2025-08-19T19:47:21.735Z
Learnt from: KJhellico
PR: vacanza/holidays#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/financial/test_national_stock_exchange_of_india.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
tests/financial/test_national_stock_exchange_of_india.py
📚 Learning: 2025-03-13T15:17:45.519Z
Learnt from: PPsyrius
PR: vacanza/holidays#2349
File: tests/countries/test_taiwan.py:0-0
Timestamp: 2025-03-13T15:17:45.519Z
Learning: For Taiwan's holiday system, different categories (GOVERNMENT, OPTIONAL, SCHOOL, WORKDAY) have distinct uses and contexts, justifying separate instances rather than parameterization in tests.
Applied to files:
tests/countries/test_taiwan.py
📚 Learning: 2025-08-28T02:42:52.725Z
Learnt from: PPsyrius
PR: vacanza/holidays#2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.725Z
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:
tests/countries/test_taiwan.py
tests/common.py
📚 Learning: 2025-08-31T09:54:22.072Z
Learnt from: PPsyrius
PR: vacanza/holidays#2874
File: tests/countries/test_taiwan.py:379-381
Timestamp: 2025-08-31T09:54:22.072Z
Learning: In Taiwan's holiday system, some holidays like Women's Day can appear in multiple categories simultaneously. Women's Day appears in the WORKDAY category for regular March 8th dates but also has special observed dates in the OPTIONAL category (1998-2000) when it was moved before Tomb-Sweeping Day. The test cases correctly reflect this dual-category behavior.
Applied to files:
tests/countries/test_taiwan.py
📚 Learning: 2025-06-16T15:48:48.680Z
Learnt from: PPsyrius
PR: vacanza/holidays#2615
File: tests/countries/test_anguilla.py:1-12
Timestamp: 2025-06-16T15:48:48.680Z
Learning: Test files in the holidays repository follow a standardized structure without module or class docstrings. All country test files use the same pattern: license header, imports, and class definition (`class Test{Country}(CommonCountryTests, TestCase):`) without docstrings. This is an established codebase convention that should be maintained for consistency.
Applied to files:
tests/countries/test_taiwan.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_taiwan.py
tests/common.py
📚 Learning: 2025-04-05T04:33:53.254Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
Applied to files:
tests/countries/test_taiwan.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_taiwan.py
tests/common.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` where HolidayClass is passed as the first argument. This is the correct signature used across all country test files.
Applied to files:
tests/countries/test_taiwan.py
tests/common.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_taiwan.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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 covered by the test_eid_al_fitr_day() method, which tests both regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
Applied to files:
tests/countries/test_taiwan.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_taiwan.py
📚 Learning: 2025-06-13T15:15:25.159Z
Learnt from: KJhellico
PR: vacanza/holidays#2609
File: tests/countries/test_nauru.py:20-24
Timestamp: 2025-06-13T15:15:25.159Z
Learning: In the vacanza/holidays test suite, overriding `setUpClass` is intentionally done with the single `cls` parameter (no *args/**kwargs), so signature-mismatch lint warnings are ignored project-wide.
Applied to files:
tests/common.py
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-04-13T20:42:13.152Z
Learnt from: KJhellico
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:52-60
Timestamp: 2025-04-13T20:42:13.152Z
Learning: In the holidays library, country classes follow a consistent initialization pattern: first explicitly initializing each parent holiday group class with their specific parameters, then calling `super().__init__(*args, **kwargs)` at the end to properly initialize the base `HolidayBase` class.
Applied to files:
tests/common.py
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
tests/common.py
📚 Learning: 2025-08-22T19:06:04.303Z
Learnt from: KJhellico
PR: vacanza/holidays#2850
File: holidays/countries/christmas_island.py:75-80
Timestamp: 2025-08-22T19:06:04.303Z
Learning: Christmas Island's docstring for the `islamic_show_estimated` parameter follows the exact same format used consistently across all countries with Islamic holidays in the codebase: "Whether to add 'estimated' label to Islamic holidays name if holiday date is estimated." This is the standard, established pattern and should not be changed.
Applied to files:
tests/common.py
🧬 Code graph analysis (3)
tests/financial/test_national_stock_exchange_of_india.py (3)
tests/common.py (5)
setUpClass
(36-121)assertHolidayName
(271-275)assertNonObservedHolidayName
(307-311)assertNoHoliday
(390-392)assertIslamicNoEstimatedNonObservedHolidayName
(313-317)tests/countries/test_taiwan.py (1)
setUpClass
(22-24)holidays/financial/national_stock_exchange_of_india.py (1)
NationalStockExchangeOfIndia
(21-130)
tests/countries/test_taiwan.py (2)
tests/common.py (12)
setUpClass
(36-121)assertGovernmentHolidayName
(277-281)assertNoGovernmentHolidayName
(431-433)assertHolidayName
(271-275)assertSchoolHolidayName
(289-293)assertNoSchoolHolidayName
(439-441)assertWorkdayHolidayName
(295-299)assertNoWorkdayHolidayName
(443-445)assertNoHolidayName
(427-429)assertOptionalHolidayName
(283-287)assertNoOptionalNonObservedHoliday
(398-400)assertNoOptionalHolidayName
(435-437)holidays/countries/taiwan.py (1)
Taiwan
(48-278)
tests/common.py (8)
holidays/holiday_base.py (1)
HolidayBase
(57-1296)tests/countries/test_azerbaijan.py (1)
setUpClass
(22-25)tests/countries/test_lebanon.py (1)
setUpClass
(22-27)tests/countries/test_china.py (1)
setUpClass
(22-23)tests/countries/test_canada.py (1)
setUpClass
(22-44)tests/countries/test_ukraine.py (1)
setUpClass
(22-23)tests/countries/test_slovakia.py (1)
setUpClass
(22-25)holidays/observed_holiday_base.py (1)
ObservedHolidayBase
(102-246)
🪛 GitHub Actions: CI/CD
tests/common.py
[error] 360-360: Ruff check error: Undefined name 'defaultdict' (F821) in tests/common.py:360.
🔇 Additional comments (12)
tests/financial/test_national_stock_exchange_of_india.py (3)
26-27
: Good move: central full_range and unified setUpClass.Adopts the shared full_range pattern and wires it into setUpClass correctly. This aligns with tests/common.py fixtures and reduces duplication.
37-38
: Consistent use of non-observed/name assertions over the full range.Using generators with self.full_range keeps the intent clear and respects NSE’s weekend-suppression behavior, while assertNoHoliday() calls pin weekend exclusions (e.g., 2025-01-26). Looks good.
If any of these named holidays were introduced/removed mid-range, double-check years in NationalStockExchangeOfIndia.start_year and per-holiday gates to avoid false positives.
Also applies to: 52-53, 56-57, 64-65, 72-73, 80-81, 88-89
227-228
: Islamic no-estimated non-observed coverage wired correctly.Switching to assertIslamicNoEstimatedNonObservedHolidayName(name, self.full_range) leverages the new fixtures from tests/common.py and removes bespoke setup. Nice cleanup.
Also applies to: 242-243, 256-257
tests/countries/test_taiwan.py (5)
23-24
: Shared full_range + setUpClass refactor is on point.Matches the new convention and simplifies per-test year specs.
135-153
: Category-scoped assertions read clean and align with supported_categories.Government/Public/School splits are accurate for 1998–2000 vs 2001+. Clear separation with negative checks.
179-179
: Full-range coverage for CNY Eve/Days is acceptable.Given start_year=1998 and continuous CNY observance, asserting presence across cls.full_range is reasonable.
If any temporary policy changes existed (e.g., skipped days), add targeted exclusions like you did for observed cases.
Also applies to: 222-222
267-282
: Workday category assertions for Taoism Day look correct.Using Workday helpers avoids bespoke instances and mirrors policy-era splits (pre-2001 vs 2001+).
300-309
: Broad switch to category-specific helpers improves clarity.Consistent use of Government/Optional/School/Workday helpers with positive and negative checks is a solid readability win and matches tests/common.py API.
Also applies to: 315-317, 327-336, 367-369, 384-385, 507-509, 515-519, 565-575, 577-579, 652-653, 671-673
tests/common.py (4)
36-36
: Dynamic fixture generation is well-structured.Auto-wiring islamic_no_estimated, non_observed, and per-category variants from supported_categories reduces boilerplate and enforces consistency.
Also applies to: 55-67, 69-86, 90-121
173-177
: Observed/non-observed sanity checks are helpful.Early assertion on instance.observed prevents accidental fixture misuse.
222-225
: New assertion helpers expand coverage without extra setup.The islamic_no_estimated and per-category “No…” counterparts complete the API surface for tests.
Also applies to: 246-249, 344-347, 394-397, 398-401, 431-446, 470-473
360-371
: Name-count helper: import fix will unblock this.Once defaultdict is imported, this counter logic is fine.
After applying the imports/logic fixes, please re-run Ruff and the affected tests to confirm CI passes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2881 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 305 305
Lines 18039 18039
Branches 2329 2329
=========================================
Hits 18039 18039 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
tests/common.py (2)
37-55
: Fix invalid default_language length check.The chained comparison can never be true; it should reject lengths outside 2–6.
Apply:
- if ( - getattr(test_class, "default_language") is not None - # Normally 2-6 letters (e.g., en, pap, en_US, pap_AW). - and 2 > len(test_class.default_language) > 6 - ): + if ( + getattr(test_class, "default_language") is not None + # Normally 2-6 letters (e.g., en, pap, en_US, pap_AW). + and not (2 <= len(test_class.default_language) <= 6) + ): raise ValueError(f"`{test_class.__name__}.default_language` value is invalid.")
139-178
: Don’t assert observed on user-supplied instances.If the first arg is a HolidayBase instance, the observed expectation should not be enforced based on instance_name.
Apply:
def _parse_arguments( self, args, expand_items=True, instance_name="holidays", raise_on_empty=True ): item_args = args instance = None + passed_instance = False - if args and issubclass(args[0].__class__, HolidayBase): + if args and issubclass(args[0].__class__, HolidayBase): instance = args[0] item_args = args[1:] + passed_instance = True else: try: instance = getattr(self, instance_name) self.assertTrue( issubclass(instance.__class__, HolidayBase), f"The `self.{instance_name}` must be a `HolidayBase` subclass.", ) except AttributeError: raise ValueError( "Either pass a holidays object (`HolidayBase` subclass) " "as a first argument or initialize your `TestCase` class " "properly with `setUpClass()` method." ) items = [] if expand_items: for item_arg in item_args: if isinstance(item_arg, (list, set, tuple)): items.extend(item_arg) elif isinstance(item_arg, (Generator, range)): items.extend(tuple(item_arg)) else: items.append(item_arg) else: items.extend(item_args) - if instance_name.endswith("_non_observed"): - self.assertFalse(instance.observed) - else: - self.assertTrue(instance.observed) + if not passed_instance: + if instance_name.endswith("_non_observed"): + self.assertFalse(instance.observed) + else: + self.assertTrue(instance.observed)Nit: prefer
isinstance(args[0], HolidayBase)
overissubclass(args[0].__class__, HolidayBase)
for clarity.
♻️ Duplicate comments (1)
tests/common.py (1)
16-16
: Ruff error resolved — thanks for adding defaultdict.The missing import is now present; CI undefined-name should be gone.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
tests/common.py
(11 hunks)
🧰 Additional context used
🧠 Learnings (17)
📓 Common learnings
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
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.
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.
Learnt from: KJhellico
PR: vacanza/holidays#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
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
📚 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/common.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
tests/common.py
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.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/common.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
Applied to files:
tests/common.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/common.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/common.py
📚 Learning: 2025-06-13T15:15:25.159Z
Learnt from: KJhellico
PR: vacanza/holidays#2609
File: tests/countries/test_nauru.py:20-24
Timestamp: 2025-06-13T15:15:25.159Z
Learning: In the vacanza/holidays test suite, overriding `setUpClass` is intentionally done with the single `cls` parameter (no *args/**kwargs), so signature-mismatch lint warnings are ignored project-wide.
Applied to files:
tests/common.py
📚 Learning: 2025-08-28T02:42:52.725Z
Learnt from: PPsyrius
PR: vacanza/holidays#2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.725Z
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:
tests/common.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` where HolidayClass is passed as the first argument. This is the correct signature used across all country test files.
Applied to files:
tests/common.py
📚 Learning: 2025-08-19T19:47:21.735Z
Learnt from: KJhellico
PR: vacanza/holidays#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/common.py
📚 Learning: 2025-04-13T20:42:13.152Z
Learnt from: KJhellico
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:52-60
Timestamp: 2025-04-13T20:42:13.152Z
Learning: In the holidays library, country classes follow a consistent initialization pattern: first explicitly initializing each parent holiday group class with their specific parameters, then calling `super().__init__(*args, **kwargs)` at the end to properly initialize the base `HolidayBase` class.
Applied to files:
tests/common.py
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
tests/common.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/common.py
📚 Learning: 2025-08-22T19:06:04.303Z
Learnt from: KJhellico
PR: vacanza/holidays#2850
File: holidays/countries/christmas_island.py:75-80
Timestamp: 2025-08-22T19:06:04.303Z
Learning: Christmas Island's docstring for the `islamic_show_estimated` parameter follows the exact same format used consistently across all countries with Islamic holidays in the codebase: "Whether to add 'estimated' label to Islamic holidays name if holiday date is estimated." This is the standard, established pattern and should not be changed.
Applied to files:
tests/common.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
PR: vacanza/holidays#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/common.py
🧬 Code graph analysis (1)
tests/common.py (7)
holidays/holiday_base.py (1)
HolidayBase
(57-1296)tests/financial/test_national_stock_exchange_of_india.py (1)
setUpClass
(25-27)tests/countries/test_azerbaijan.py (1)
setUpClass
(22-25)tests/countries/test_china.py (1)
setUpClass
(22-23)tests/countries/test_lebanon.py (1)
setUpClass
(22-27)tests/countries/test_canada.py (1)
setUpClass
(22-44)holidays/observed_holiday_base.py (1)
ObservedHolidayBase
(102-246)
⏰ 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). (1)
- GitHub Check: Test Python 3.13 on windows-latest
🔇 Additional comments (15)
tests/common.py (15)
19-19
: LGTM: using inspect.signature for ctor introspection.
25-25
: LGTM: PUBLIC import for category filtering.
56-75
: Sensible defaults for islamic/no-estimated and non-observed variants.Good reduction of boilerplate.
76-87
: Auto year-variants per supported_categories looks right (PUBLIC excluded).Nice groundwork for category helpers.
98-121
: Category/special-flag/non-observed wiring looks consistent.The name-based routing to ctor kwargs is clear.
223-226
: LGTM: Islamic no-estimated holiday helper.
247-250
: LGTM: Islamic no-estimated dates helper.
278-307
: LGTM: Category- and Islamic-specific assertHolidayName helpers.This will cut a lot of per-suite boilerplate.
314-319
: LGTM: Islamic no-estimated non-observed name helper.
345-348
: LGTM: Islamic no-estimated assertHolidays.
395-402
: LGTM: Negative checks for Islamic no-estimated and optional/non-observed.
432-451
: LGTM: Negative name checks across categories and Islamic no-estimated.
471-474
: LGTM: Negative dict check for Islamic no-estimated holidays.
211-231
: Sanity: helpers read well; method naming consistent with suite conventions.No blockers here.
Also applies to: 241-254, 320-352, 373-382, 391-406, 428-455, 467-478
536-545
: Support observed_rule as Mapping or objectFile: tests/common.py 536–545
Replace the.values()
call onobserved_rule
with a mapping check so it won’t crash whenobserved_rule
is anObservedRule
instance:- obs_rule = getattr(self.holidays, "observed_rule", None) - has_observed_rules = ( - hasattr(obs_rule, "values") - and any(rule is not None for rule in obs_rule.values()) - ) or (obs_rule is not None and not hasattr(obs_rule, "values")) + from collections.abc import Mapping + + obs_rule = getattr(self.holidays, "observed_rule", None) + if isinstance(obs_rule, Mapping): + has_observed_rules = any(rule is not None for rule in obs_rule.values()) + else: + has_observed_rules = obs_rule is not NoneThen use
has_observed_rules
in the existingif(estimated_label && observed_label && has_observed_rules):
check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
tests/common.py (3)
102-107
: Fix impossible default_language length check.Condition
2 > len(x) > 6
is never true. Use a proper bounds check.Apply:
- if ( - getattr(test_class, "default_language") is not None - # Normally 2-6 letters (e.g., en, pap, en_US, pap_AW). - and 2 > len(test_class.default_language) > 6 - ): + if ( + getattr(test_class, "default_language") is not None + # Normally 2-6 letters (e.g., en, pap, en_US, pap_AW). + and not (2 <= len(test_class.default_language) <= 6) + ):
286-291
: Type mismatch breaks exact-set comparison in assertHolidayDates.Comparing expected strings to actual date keys always reports diffs. Normalize both sides.
Apply:
- for dt in dates: - self.assertIn(dt, holidays, dt) - - self.assertEqual(len(dates), len(holidays.keys()), set(dates).difference(holidays.keys())) + for dt in dates: + self.assertIn(dt, holidays, dt) + + # Normalize to string dates for consistent comparison. + expected = {dt if isinstance(dt, str) else dt.strftime("%Y-%m-%d") for dt in dates} + actual = {dt.strftime("%Y-%m-%d") for dt in holidays.keys()} + self.assertEqual(len(expected), len(actual), expected.difference(actual))
393-397
: Use int year for localized fixture construction.Passing a string year may rely on implicit coercion. Cast explicitly.
Apply:
- instance = self.test_class( - years=localized_holidays[0][0].split("-")[0], + instance = self.test_class( + years=int(localized_holidays[0][0][:4]),
♻️ Duplicate comments (3)
tests/countries/test_serbia.py (3)
77-89
: Orthodox Holy Saturday — LGTMPattern mirrors Good Friday; concise coverage.
90-102
: Orthodox Easter Sunday — LGTMAdds newly implemented public holiday; full-range presence asserted.
103-115
: Orthodox Easter Monday — LGTMConsistent with added holiday set; range assertion included.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (27)
holidays/countries/serbia.py
(2 hunks)tests/common.py
(10 hunks)tests/countries/test_bangladesh.py
(1 hunks)tests/countries/test_belgium.py
(3 hunks)tests/countries/test_burkina_faso.py
(1 hunks)tests/countries/test_chad.py
(1 hunks)tests/countries/test_colombia.py
(12 hunks)tests/countries/test_congo.py
(5 hunks)tests/countries/test_denmark.py
(2 hunks)tests/countries/test_djibouti.py
(1 hunks)tests/countries/test_dominican_republic.py
(5 hunks)tests/countries/test_gabon.py
(1 hunks)tests/countries/test_greenland.py
(2 hunks)tests/countries/test_honduras.py
(5 hunks)tests/countries/test_iran.py
(2 hunks)tests/countries/test_kyrgyzstan.py
(2 hunks)tests/countries/test_luxembourg.py
(3 hunks)tests/countries/test_monaco.py
(4 hunks)tests/countries/test_morocco.py
(2 hunks)tests/countries/test_netherlands.py
(2 hunks)tests/countries/test_norway.py
(1 hunks)tests/countries/test_serbia.py
(1 hunks)tests/countries/test_singapore.py
(9 hunks)tests/countries/test_solomon_islands.py
(1 hunks)tests/countries/test_tunisia.py
(1 hunks)tests/financial/test_ny_stock_exchange.py
(1 hunks)tests/test_package.py
(0 hunks)
💤 Files with no reviewable changes (1)
- tests/test_package.py
🧰 Additional context used
🧠 Learnings (47)
📓 Common learnings
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
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.
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.
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.
Learnt from: KJhellico
PR: vacanza/holidays#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
PR: vacanza/holidays#2642
File: tests/countries/test_france.py:24-27
Timestamp: 2025-06-18T10:10:46.158Z
Learning: The holidays library prioritizes full test coverage over performance in test suites. Modern library-wide standards favor comprehensive testing across all subdivisions and wide year ranges (e.g., 1803-2050 for France) to ensure thorough validation, even if it creates many test objects.
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Learnt from: KJhellico
PR: vacanza/holidays#2783
File: tests/countries/test_eritrea.py:130-147
Timestamp: 2025-08-18T13:06:16.919Z
Learning: The `assertLocalizedHolidays` method in the vacanza/holidays project requires a complete list of all holidays from all categories (PUBLIC, GOVERNMENT, etc.), not just the holidays from the default category. This is a framework requirement for comprehensive localization testing.
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:49:19.654Z
Learning: The assertLocalizedHolidays method in the vacanza/holidays project requires a complete list of all holidays for the specific year being tested, not just a subset. When testing localization, all holidays from that year must be included in the assertion.
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:21:59.302Z
Learning: In the Saint Vincent and the Grenadines holiday tests, for holidays without observed rules that only require a single assertHolidayName call, pass the holiday name directly as a string literal rather than storing it in a variable first for cleaner, more concise code.
📚 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_congo.py
tests/countries/test_solomon_islands.py
tests/countries/test_netherlands.py
tests/countries/test_greenland.py
tests/countries/test_burkina_faso.py
tests/countries/test_bangladesh.py
tests/countries/test_belgium.py
tests/countries/test_iran.py
tests/countries/test_chad.py
tests/countries/test_djibouti.py
tests/countries/test_monaco.py
tests/financial/test_ny_stock_exchange.py
tests/countries/test_dominican_republic.py
tests/countries/test_denmark.py
tests/countries/test_tunisia.py
tests/countries/test_luxembourg.py
tests/countries/test_norway.py
tests/countries/test_gabon.py
tests/countries/test_colombia.py
tests/countries/test_morocco.py
tests/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_singapore.py
tests/countries/test_serbia.py
tests/countries/test_honduras.py
📚 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_congo.py
tests/countries/test_solomon_islands.py
tests/countries/test_netherlands.py
tests/countries/test_greenland.py
tests/countries/test_burkina_faso.py
tests/countries/test_bangladesh.py
tests/countries/test_belgium.py
tests/countries/test_iran.py
tests/countries/test_chad.py
tests/countries/test_djibouti.py
tests/countries/test_monaco.py
tests/financial/test_ny_stock_exchange.py
tests/countries/test_dominican_republic.py
tests/countries/test_denmark.py
tests/countries/test_tunisia.py
tests/countries/test_luxembourg.py
tests/countries/test_norway.py
tests/countries/test_gabon.py
tests/countries/test_colombia.py
tests/countries/test_morocco.py
tests/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_singapore.py
tests/countries/test_serbia.py
tests/countries/test_honduras.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_congo.py
tests/countries/test_solomon_islands.py
tests/countries/test_netherlands.py
tests/countries/test_greenland.py
tests/countries/test_burkina_faso.py
tests/countries/test_belgium.py
tests/countries/test_iran.py
tests/countries/test_chad.py
tests/countries/test_djibouti.py
tests/countries/test_monaco.py
tests/countries/test_dominican_republic.py
tests/countries/test_denmark.py
tests/countries/test_tunisia.py
tests/countries/test_luxembourg.py
tests/countries/test_norway.py
tests/countries/test_gabon.py
tests/countries/test_morocco.py
tests/common.py
tests/countries/test_serbia.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_congo.py
tests/countries/test_solomon_islands.py
tests/countries/test_netherlands.py
tests/countries/test_greenland.py
tests/countries/test_burkina_faso.py
tests/countries/test_bangladesh.py
tests/countries/test_belgium.py
tests/countries/test_iran.py
tests/countries/test_chad.py
tests/countries/test_djibouti.py
tests/countries/test_monaco.py
tests/financial/test_ny_stock_exchange.py
tests/countries/test_dominican_republic.py
tests/countries/test_denmark.py
tests/countries/test_tunisia.py
tests/countries/test_luxembourg.py
tests/countries/test_norway.py
tests/countries/test_gabon.py
tests/countries/test_colombia.py
tests/countries/test_morocco.py
tests/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_singapore.py
tests/countries/test_serbia.py
tests/countries/test_honduras.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:
tests/countries/test_congo.py
tests/countries/test_burkina_faso.py
tests/countries/test_djibouti.py
tests/countries/test_dominican_republic.py
tests/countries/test_luxembourg.py
tests/countries/test_morocco.py
tests/countries/test_honduras.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:
tests/countries/test_congo.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_congo.py
tests/countries/test_solomon_islands.py
tests/countries/test_netherlands.py
tests/countries/test_greenland.py
tests/countries/test_burkina_faso.py
tests/countries/test_bangladesh.py
tests/countries/test_belgium.py
tests/countries/test_iran.py
tests/countries/test_chad.py
tests/countries/test_djibouti.py
tests/countries/test_monaco.py
tests/financial/test_ny_stock_exchange.py
tests/countries/test_dominican_republic.py
tests/countries/test_tunisia.py
tests/countries/test_luxembourg.py
tests/countries/test_norway.py
tests/countries/test_gabon.py
tests/countries/test_colombia.py
tests/countries/test_morocco.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_singapore.py
tests/countries/test_honduras.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_solomon_islands.py
tests/countries/test_greenland.py
tests/countries/test_chad.py
tests/financial/test_ny_stock_exchange.py
tests/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_singapore.py
📚 Learning: 2025-07-02T18:21:59.302Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:21:59.302Z
Learning: In the Saint Vincent and the Grenadines holiday tests, for holidays without observed rules that only require a single assertHolidayName call, pass the holiday name directly as a string literal rather than storing it in a variable first for cleaner, more concise code.
Applied to files:
tests/countries/test_solomon_islands.py
tests/countries/test_netherlands.py
tests/countries/test_greenland.py
tests/countries/test_luxembourg.py
📚 Learning: 2025-04-02T18:38:35.164Z
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
Applied to files:
tests/countries/test_solomon_islands.py
tests/countries/test_netherlands.py
tests/countries/test_belgium.py
tests/countries/test_iran.py
tests/countries/test_djibouti.py
tests/countries/test_monaco.py
tests/countries/test_dominican_republic.py
tests/countries/test_denmark.py
tests/countries/test_tunisia.py
tests/countries/test_luxembourg.py
tests/countries/test_norway.py
tests/countries/test_morocco.py
tests/common.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
tests/countries/test_solomon_islands.py
tests/countries/test_netherlands.py
tests/countries/test_greenland.py
tests/countries/test_burkina_faso.py
tests/countries/test_bangladesh.py
tests/countries/test_belgium.py
tests/countries/test_chad.py
tests/countries/test_djibouti.py
tests/financial/test_ny_stock_exchange.py
tests/countries/test_dominican_republic.py
tests/countries/test_tunisia.py
tests/countries/test_luxembourg.py
tests/countries/test_gabon.py
tests/common.py
tests/countries/test_singapore.py
tests/countries/test_serbia.py
tests/countries/test_honduras.py
📚 Learning: 2025-06-16T15:48:48.680Z
Learnt from: PPsyrius
PR: vacanza/holidays#2615
File: tests/countries/test_anguilla.py:1-12
Timestamp: 2025-06-16T15:48:48.680Z
Learning: Test files in the holidays repository follow a standardized structure without module or class docstrings. All country test files use the same pattern: license header, imports, and class definition (`class Test{Country}(CommonCountryTests, TestCase):`) without docstrings. This is an established codebase convention that should be maintained for consistency.
Applied to files:
tests/countries/test_solomon_islands.py
tests/countries/test_dominican_republic.py
tests/common.py
📚 Learning: 2025-04-23T09:59:19.886Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_solomon_islands.py
tests/countries/test_burkina_faso.py
📚 Learning: 2025-08-12T17:16:54.497Z
Learnt from: PPsyrius
PR: vacanza/holidays#2794
File: tests/calendars/test_julian.py:35-36
Timestamp: 2025-08-12T17:16:54.497Z
Learning: In the vacanza/holidays project calendar tests (Thai, Ethiopian, Julian, etc.), the established testing pattern for validation methods is to use simple for loops like `for year in known_data_dict:` followed by `self.assertEqual(expected, actual)` without using unittest's subTest feature. This pattern is consistently maintained across all calendar test files.
Applied to files:
tests/countries/test_solomon_islands.py
📚 Learning: 2025-06-18T10:07:58.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: holidays/countries/french_southern_territories.py:41-44
Timestamp: 2025-06-18T10:07:58.780Z
Learning: Territorial holiday classes that inherit from parent countries (like HolidaysAX from Finland, HolidaysSJ from Norway, HolidaysTF from France) follow a standard pattern of silently overriding self.subdiv in their _populate_public_holidays() method without validation, as this ensures they always use the correct subdivision code for their territory regardless of user input.
Applied to files:
tests/countries/test_solomon_islands.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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 covered by the test_eid_al_fitr_day() method, which tests both regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
Applied to files:
tests/countries/test_solomon_islands.py
tests/countries/test_greenland.py
tests/countries/test_burkina_faso.py
tests/countries/test_iran.py
tests/countries/test_chad.py
tests/countries/test_djibouti.py
tests/countries/test_tunisia.py
tests/countries/test_gabon.py
tests/countries/test_morocco.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_honduras.py
📚 Learning: 2025-04-23T14:55:35.504Z
Learnt from: PPsyrius
PR: vacanza/holidays#2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.
Applied to files:
tests/countries/test_netherlands.py
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-08-19T19:47:21.735Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_greenland.py
tests/countries/test_bangladesh.py
tests/financial/test_ny_stock_exchange.py
tests/countries/test_norway.py
tests/countries/test_gabon.py
tests/countries/test_colombia.py
tests/countries/test_singapore.py
tests/countries/test_honduras.py
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_bangladesh.py
tests/countries/test_iran.py
tests/countries/test_chad.py
tests/countries/test_denmark.py
tests/countries/test_tunisia.py
tests/countries/test_norway.py
tests/countries/test_gabon.py
tests/countries/test_colombia.py
tests/countries/test_morocco.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_singapore.py
tests/countries/test_honduras.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
tests/countries/test_bangladesh.py
tests/countries/test_iran.py
tests/countries/test_chad.py
tests/countries/test_djibouti.py
tests/countries/test_denmark.py
tests/countries/test_tunisia.py
tests/countries/test_norway.py
tests/countries/test_colombia.py
tests/countries/test_morocco.py
tests/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
tests/countries/test_honduras.py
📚 Learning: 2025-05-09T18:36:09.607Z
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Applied to files:
tests/countries/test_iran.py
tests/financial/test_ny_stock_exchange.py
tests/common.py
tests/countries/test_serbia.py
tests/countries/test_honduras.py
📚 Learning: 2025-08-28T02:42:52.725Z
Learnt from: PPsyrius
PR: vacanza/holidays#2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.725Z
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:
tests/countries/test_chad.py
tests/countries/test_djibouti.py
tests/countries/test_dominican_republic.py
tests/countries/test_denmark.py
tests/countries/test_luxembourg.py
tests/countries/test_gabon.py
tests/countries/test_colombia.py
tests/countries/test_morocco.py
tests/common.py
tests/countries/test_singapore.py
tests/countries/test_honduras.py
📚 Learning: 2025-06-18T10:10:46.158Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_france.py:24-27
Timestamp: 2025-06-18T10:10:46.158Z
Learning: The holidays library prioritizes full test coverage over performance in test suites. Modern library-wide standards favor comprehensive testing across all subdivisions and wide year ranges (e.g., 1803-2050 for France) to ensure thorough validation, even if it creates many test objects.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-08-20T19:46:15.625Z
Learnt from: KJhellico
PR: vacanza/holidays#2833
File: tests/countries/test_uganda.py:15-0
Timestamp: 2025-08-20T19:46:15.625Z
Learning: In the holidays project, the standard import pattern for country test files is `from holidays.countries.<country> import Country, CODE1, CODE2` (direct module import), used by ~75% of country test files. Only a minority (~25%) use the aggregated public API import `from holidays.countries import Country, CODE1, CODE2`. The direct module import pattern should be used for new country test files to follow the established convention.
Applied to files:
tests/countries/test_denmark.py
📚 Learning: 2025-08-30T12:49:19.654Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:49:19.654Z
Learning: The assertLocalizedHolidays method in the vacanza/holidays project requires a complete list of all holidays for the specific year being tested, not just a subset. When testing localization, all holidays from that year must be included in the assertion.
Applied to files:
tests/countries/test_luxembourg.py
tests/common.py
📚 Learning: 2025-06-14T10:58:43.636Z
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.
Applied to files:
tests/countries/test_norway.py
tests/common.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
Applied to files:
tests/countries/test_colombia.py
tests/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.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/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
📚 Learning: 2025-06-13T15:15:25.159Z
Learnt from: KJhellico
PR: vacanza/holidays#2609
File: tests/countries/test_nauru.py:20-24
Timestamp: 2025-06-13T15:15:25.159Z
Learning: In the vacanza/holidays test suite, overriding `setUpClass` is intentionally done with the single `cls` parameter (no *args/**kwargs), so signature-mismatch lint warnings are ignored project-wide.
Applied to files:
tests/common.py
tests/countries/test_kyrgyzstan.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` where HolidayClass is passed as the first argument. This is the correct signature used across all country test files.
Applied to files:
tests/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
📚 Learning: 2025-05-12T15:31:58.079Z
Learnt from: KJhellico
PR: vacanza/holidays#2532
File: tests/countries/test_cocos_islands.py:78-89
Timestamp: 2025-05-12T15:31:58.079Z
Learning: In the holidays project, tests for movable holidays (like Easter Monday) should always use static date sets only, not calculation functions.
Applied to files:
tests/common.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.py
tests/countries/test_serbia.py
📚 Learning: 2025-08-03T13:48:11.910Z
Learnt from: KJhellico
PR: vacanza/holidays#2777
File: holidays/countries/gambia.py:120-122
Timestamp: 2025-08-03T13:48:11.910Z
Learning: When reviewing holiday implementations in the holidays library, defer to the maintainers' choice of start years for specific holiday policies, as they likely have access to more reliable primary sources and official documentation than what can be found through web searches.
Applied to files:
tests/common.py
📚 Learning: 2025-06-15T15:24:53.055Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/common.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/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
📚 Learning: 2025-04-13T20:42:13.152Z
Learnt from: KJhellico
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:52-60
Timestamp: 2025-04-13T20:42:13.152Z
Learning: In the holidays library, country classes follow a consistent initialization pattern: first explicitly initializing each parent holiday group class with their specific parameters, then calling `super().__init__(*args, **kwargs)` at the end to properly initialize the base `HolidayBase` class.
Applied to files:
tests/common.py
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
tests/common.py
📚 Learning: 2025-08-30T12:52:58.513Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:52:58.513Z
Learning: In the NSE holidays implementation, assertLocalizedHolidays should only include holidays that are actually observed (trading holidays), not holidays that fall on weekends and are excluded by the observed_rule. For example, Eid al-Fitr 2023 falls on Saturday and is correctly excluded from localization tests.
Applied to files:
tests/common.py
📚 Learning: 2025-03-23T16:59:25.794Z
Learnt from: PPsyrius
PR: vacanza/holidays#2362
File: tests/test_ical.py:31-40
Timestamp: 2025-03-23T16:59:25.794Z
Learning: In the holidays library's `TestIcalExporter` class, initializing `ICalExporter` with `None` is intentional. Using a mock object instead breaks tests because the constructor performs attribute validation with `getattr(self.holidays, "language", None)` which returns a mock with a mock object instead of `None`, causing validation failures. The approach isolates file operation tests from iCal generation logic.
Applied to files:
tests/common.py
📚 Learning: 2025-04-05T04:33:53.254Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
Applied to files:
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
📚 Learning: 2025-06-22T21:36:18.015Z
Learnt from: KJhellico
PR: vacanza/holidays#2671
File: tests/countries/test_libya.py:19-24
Timestamp: 2025-06-22T21:36:18.015Z
Learning: In the vacanza/holidays project, test classes for countries do not use docstrings. All test classes follow the same pattern: class declaration directly followed by classmethod def setUpClass(cls) without any docstrings for the class or methods.
Applied to files:
tests/countries/test_kyrgyzstan.py
📚 Learning: 2025-06-14T11:05:21.250Z
Learnt from: PPsyrius
PR: vacanza/holidays#2609
File: holidays/countries/nauru.py:48-50
Timestamp: 2025-06-14T11:05:21.250Z
Learning: In the holidays library, newer implementations use `start_year` to indicate the earliest year with complete holiday data coverage, not necessarily the first year a holiday existed. If a holiday system starts partway through a year (like Nauru's Public Holidays Act starting Jan 31, 1968), the start_year should be set to the following year (1969) to ensure users get full annual holiday coverage.
Applied to files:
holidays/countries/serbia.py
📚 Learning: 2025-06-14T11:04:31.180Z
Learnt from: PPsyrius
PR: vacanza/holidays#2609
File: holidays/countries/nauru.py:57-60
Timestamp: 2025-06-14T11:04:31.180Z
Learning: In the holidays library, the base `HolidayBase._populate()` method already includes a guard clause that prevents holiday population methods like `_populate_public_holidays()` from being called when the year is before `start_year` or after `end_year`. Therefore, individual country implementations do not need to add their own guard clauses for years before independence or other start dates.
Applied to files:
holidays/countries/serbia.py
📚 Learning: 2025-08-21T04:56:03.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/serbia.py
📚 Learning: 2025-07-08T10:21:37.055Z
Learnt from: KJhellico
PR: vacanza/holidays#2701
File: holidays/countries/palestine.py:122-122
Timestamp: 2025-07-08T10:21:37.055Z
Learning: In Palestine, Easter follows the same naming pattern as Christmas - both the first and second days of Easter have identical names for the respective religious groups (Catholic or Orthodox). The implementation correctly uses `_add_easter_sunday` for nationwide holidays and `_add_easter_monday` for group-specific second days, but both share the same Arabic name "عيد الفصح المجيد".
Applied to files:
holidays/countries/serbia.py
📚 Learning: 2025-08-21T04:56:03.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/serbia.py
🧬 Code graph analysis (25)
tests/countries/test_congo.py (1)
holidays/countries/congo.py (1)
Congo
(19-71)
tests/countries/test_netherlands.py (1)
holidays/countries/netherlands.py (1)
Netherlands
(20-92)
tests/countries/test_greenland.py (1)
holidays/countries/greenland.py (1)
Greenland
(20-90)
tests/countries/test_burkina_faso.py (1)
holidays/countries/burkina_faso.py (1)
BurkinaFaso
(19-100)
tests/countries/test_bangladesh.py (1)
holidays/countries/bangladesh.py (1)
Bangladesh
(18-53)
tests/countries/test_belgium.py (1)
holidays/countries/belgium.py (1)
Belgium
(20-85)
tests/countries/test_iran.py (1)
holidays/countries/iran.py (1)
Iran
(35-153)
tests/countries/test_chad.py (1)
holidays/countries/chad.py (1)
Chad
(24-96)
tests/countries/test_djibouti.py (1)
holidays/countries/djibouti.py (1)
Djibouti
(20-82)
tests/countries/test_monaco.py (1)
holidays/countries/monaco.py (1)
Monaco
(20-78)
tests/financial/test_ny_stock_exchange.py (1)
holidays/financial/ny_stock_exchange.py (1)
NewYorkStockExchange
(34-139)
tests/countries/test_dominican_republic.py (1)
holidays/countries/dominican_republic.py (1)
DominicanRepublic
(24-84)
tests/countries/test_denmark.py (1)
holidays/countries/denmark.py (1)
Denmark
(20-85)
tests/countries/test_tunisia.py (1)
holidays/countries/tunisia.py (1)
Tunisia
(19-85)
tests/countries/test_luxembourg.py (1)
holidays/countries/luxembourg.py (1)
Luxembourg
(20-81)
tests/countries/test_norway.py (1)
holidays/countries/norway.py (1)
Norway
(20-130)
tests/countries/test_gabon.py (1)
holidays/countries/gabon.py (1)
Gabon
(19-86)
tests/countries/test_colombia.py (1)
holidays/countries/colombia.py (1)
Colombia
(19-112)
tests/countries/test_morocco.py (1)
holidays/countries/morocco.py (1)
Morocco
(19-107)
tests/common.py (18)
holidays/holiday_base.py (3)
HolidayBase
(57-1296)get_named
(988-1044)get
(946-969)tests/financial/test_national_stock_exchange_of_india.py (1)
setUpClass
(25-27)tests/countries/test_china.py (1)
setUpClass
(22-23)tests/countries/test_taiwan.py (1)
setUpClass
(22-24)tests/countries/test_azerbaijan.py (1)
setUpClass
(22-25)tests/countries/test_lebanon.py (1)
setUpClass
(22-27)tests/countries/test_canada.py (1)
setUpClass
(22-44)tests/countries/test_chile.py (1)
setUpClass
(22-23)tests/countries/test_germany.py (1)
setUpClass
(23-28)tests/countries/test_switzerland.py (1)
setUpClass
(22-31)tests/countries/test_vietnam.py (1)
setUpClass
(23-24)tests/countries/test_ukraine.py (1)
setUpClass
(22-23)tests/countries/test_south_korea.py (1)
setUpClass
(23-24)tests/countries/test_slovakia.py (1)
setUpClass
(22-25)tests/countries/test_austria.py (1)
setUpClass
(22-23)tests/countries/test_japan.py (1)
setUpClass
(22-23)tests/countries/test_bulgaria.py (1)
setUpClass
(22-23)holidays/observed_holiday_base.py (1)
ObservedHolidayBase
(102-246)
tests/countries/test_kyrgyzstan.py (3)
tests/countries/test_dominican_republic.py (2)
setUpClass
(21-22)test_country_aliases
(24-25)holidays/countries/kyrgyzstan.py (3)
Kyrgyzstan
(18-88)KG
(91-92)KGZ
(95-96)tests/common.py (1)
assertAliases
(251-260)
tests/countries/test_singapore.py (1)
holidays/countries/singapore.py (1)
Singapore
(34-146)
tests/countries/test_serbia.py (3)
tests/common.py (2)
setUpClass
(93-183)assertAliases
(251-260)tests/countries/test_montenegro.py (1)
setUpClass
(22-28)holidays/countries/serbia.py (2)
Serbia
(20-77)RS
(80-81)
holidays/countries/serbia.py (1)
holidays/groups/christian.py (2)
_add_holy_saturday
(355-362)_add_easter_sunday
(286-295)
tests/countries/test_honduras.py (1)
holidays/countries/honduras.py (1)
Honduras
(19-77)
⏰ 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). (1)
- GitHub Check: Test Python 3.13 on windows-latest
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/common.py (1)
150-156
: Use isinstance instead of issubclass for type checking.More idiomatic and handles edge cases better.
- for suffix, ylist in variants.items(): - if ylist is None: - continue - - attr_name = "holidays" + (f"_{suffix.replace('years_', '')}" if suffix else "") - init_kwargs = {"years": ylist} + for suffix, ylist in variants.items(): + if ylist is None: + continue + + attr_name = "holidays" + (f"_{suffix.replace('years_', '')}" if suffix else "") + init_kwargs = {"years": ylist}
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
snapshots/countries/RS_COMMON.json
(0 hunks)tests/common.py
(11 hunks)
💤 Files with no reviewable changes (1)
- snapshots/countries/RS_COMMON.json
🧰 Additional context used
🧠 Learnings (26)
📓 Common learnings
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
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.
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.
Learnt from: KJhellico
PR: vacanza/holidays#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: 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.
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.725Z
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.
📚 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/common.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
Applied to files:
tests/common.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/common.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/common.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/common.py
📚 Learning: 2025-06-13T15:15:25.159Z
Learnt from: KJhellico
PR: vacanza/holidays#2609
File: tests/countries/test_nauru.py:20-24
Timestamp: 2025-06-13T15:15:25.159Z
Learning: In the vacanza/holidays test suite, overriding `setUpClass` is intentionally done with the single `cls` parameter (no *args/**kwargs), so signature-mismatch lint warnings are ignored project-wide.
Applied to files:
tests/common.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
tests/common.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
PR: vacanza/holidays#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/common.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/common.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
tests/common.py
📚 Learning: 2025-04-02T18:38:35.164Z
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
Applied to files:
tests/common.py
📚 Learning: 2025-05-09T18:36:09.607Z
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Applied to files:
tests/common.py
📚 Learning: 2025-05-12T15:31:58.079Z
Learnt from: KJhellico
PR: vacanza/holidays#2532
File: tests/countries/test_cocos_islands.py:78-89
Timestamp: 2025-05-12T15:31:58.079Z
Learning: In the holidays project, tests for movable holidays (like Easter Monday) should always use static date sets only, not calculation functions.
Applied to files:
tests/common.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-08-03T13:48:11.910Z
Learnt from: KJhellico
PR: vacanza/holidays#2777
File: holidays/countries/gambia.py:120-122
Timestamp: 2025-08-03T13:48:11.910Z
Learning: When reviewing holiday implementations in the holidays library, defer to the maintainers' choice of start years for specific holiday policies, as they likely have access to more reliable primary sources and official documentation than what can be found through web searches.
Applied to files:
tests/common.py
📚 Learning: 2025-06-14T10:58:43.636Z
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.
Applied to files:
tests/common.py
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
tests/common.py
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-06-15T15:24:53.055Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` where HolidayClass is passed as the first argument. This is the correct signature used across all country test files.
Applied to files:
tests/common.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/common.py
📚 Learning: 2025-04-13T20:42:13.152Z
Learnt from: KJhellico
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:52-60
Timestamp: 2025-04-13T20:42:13.152Z
Learning: In the holidays library, country classes follow a consistent initialization pattern: first explicitly initializing each parent holiday group class with their specific parameters, then calling `super().__init__(*args, **kwargs)` at the end to properly initialize the base `HolidayBase` class.
Applied to files:
tests/common.py
📚 Learning: 2025-08-30T12:52:58.513Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:52:58.513Z
Learning: In the NSE holidays implementation, assertLocalizedHolidays should only include holidays that are actually observed (trading holidays), not holidays that fall on weekends and are excluded by the observed_rule. For example, Eid al-Fitr 2023 falls on Saturday and is correctly excluded from localization tests.
Applied to files:
tests/common.py
📚 Learning: 2025-08-30T12:49:19.654Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:49:19.654Z
Learning: The assertLocalizedHolidays method in the vacanza/holidays project requires a complete list of all holidays for the specific year being tested, not just a subset. When testing localization, all holidays from that year must be included in the assertion.
Applied to files:
tests/common.py
📚 Learning: 2025-03-23T16:59:25.794Z
Learnt from: PPsyrius
PR: vacanza/holidays#2362
File: tests/test_ical.py:31-40
Timestamp: 2025-03-23T16:59:25.794Z
Learning: In the holidays library's `TestIcalExporter` class, initializing `ICalExporter` with `None` is intentional. Using a mock object instead breaks tests because the constructor performs attribute validation with `getattr(self.holidays, "language", None)` which returns a mock with a mock object instead of `None`, causing validation failures. The approach isolates file operation tests from iCal generation logic.
Applied to files:
tests/common.py
🧬 Code graph analysis (1)
tests/common.py (4)
holidays/holiday_base.py (3)
HolidayBase
(57-1296)get_named
(988-1044)get
(946-969)tests/financial/test_national_stock_exchange_of_india.py (1)
setUpClass
(25-27)tests/countries/test_azerbaijan.py (1)
setUpClass
(22-25)holidays/observed_holiday_base.py (1)
ObservedHolidayBase
(102-246)
🔇 Additional comments (10)
tests/common.py (10)
19-19
: Import signature is already available from inspect.Good addition for the dynamic method generation feature.
25-25
: Import PUBLIC constant for category handling.Necessary for the new category-aware test setup.
37-91
: Clean implementation of dynamic assertion method generation.The
_generate_assert_methods
elegantly creates variant-specific assertion wrappers at runtime. The use of closures withmake_assert
functions properly captures the instance name for each variant.
206-206
: Good fix: isinstance replaces issubclass pattern.The change from
issubclass(args[0].__class__, HolidayBase)
toisinstance(args[0], HolidayBase)
is more Pythonic.
235-238
: Logic for observed flag validation.The validation correctly checks that instances ending with
_non_observed
haveobserved=False
and others haveobserved=True
.
280-290
: Renamed from assertHolidayDates to _assertHolidayDates.The method is now internal and will be wrapped by dynamically generated public methods.
310-327
: New helper: _assertHolidayNameCount.Useful addition for verifying the frequency of holidays with specific names across years.
70-74
: No action needed: wrapper argument order matches _assertHolidayNameCount signature.
112-114
: Changing the default torange(1950, 2050)
is safe; all country tests explicitly pass their own ranges (e.g.range(1957,2050)
), so no test relies on an unspecified default.
93-93
: setUpClass signature is backward-compatible
The updated method still declarestest_class=None
,years=None
, and uses**year_variants
to absorb extra named arguments (e.g.years_non_observed
), so existingsuper().setUpClass(...)
calls continue to work without changes.Likely an incorrect or invalid review 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: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (5)
tests/common.py (5)
185-193
: Guard against missing test_class in setUp to prevent AttributeError.When a subclass forgets to call setUpClass, self.test_class is absent.
def setUp(self): super().setUp() - if getattr(self.test_class, "default_language") is not None: - self.set_language(self.test_class.default_language) + test_class = getattr(self, "test_class", None) + if test_class and getattr(test_class, "default_language", None) is not None: + self.set_language(test_class.default_language) - if not hasattr(self, "holidays"): - self.holidays = self.test_class() + if not hasattr(self, "holidays") and test_class: + self.holidays = test_class() - if not hasattr(self, "holidays_non_observed"): - self.holidays_non_observed = self.test_class(observed=False) + if not hasattr(self, "holidays_non_observed") and test_class: + self.holidays_non_observed = test_class(observed=False)
194-197
: Make set_language a staticmethod.Removes ambiguity when called from class/instance and matches usage in setUpClass.
- def set_language(self, language): + @staticmethod + def set_language(language): os.environ["LANGUAGE"] = language
290-305
: Handle non-date strings safely in name assertions.parse(...) can raise for invalid inputs. Guard it to produce a controlled error.
- elif isinstance(arg, date) or parse(arg): # Exact date check. + elif isinstance(arg, date) or (isinstance(arg, str) and _is_parsable_date(arg)): for dt in items: self.assertIn(name, holidays.get_list(dt), dt) else: raise ValueError(f"The {arg} wasn't caught by `assertHolidayName()`")Add helper (module-level or inside class):
+def _is_parsable_date(s: str) -> bool: + try: + parse(s) + return True + except Exception: + return False
356-375
: Mirror safe parsing in negative-name assertions.Keep behavior consistent with _assertHolidayName.
- elif isinstance(arg, date) or parse(arg): # Exact date check. + elif isinstance(arg, date) or (isinstance(arg, str) and _is_parsable_date(arg)): for dt in items: self.assertNotIn(name, holidays.get_list(dt), dt) else: raise ValueError(f"The {arg} wasn't caught by `assertNoHolidayName()`")
388-395
: Cast year to int in localized assertions.years should be an int; passing a string relies on implicit normalization.
- instance = self.test_class( - years=localized_holidays[0][0].split("-")[0], + year = int(localized_holidays[0][0].split("-")[0]) + instance = self.test_class( + years=year, language=language, categories=self.test_class.supported_categories, )
♻️ Duplicate comments (1)
tests/common.py (1)
203-214
: Prefer isinstance over issubclass(obj.class, …).More idiomatic and handles proxies/mocks better. This also aligns with your earlier change on args[0].
- self.assertTrue( - issubclass(instance.__class__, HolidayBase), - f"The `self.{instance_name}` must be a `HolidayBase` subclass.", - ) + self.assertTrue( + isinstance(instance, HolidayBase), + f"The `self.{instance_name}` must be a `HolidayBase` subclass.", + )
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
tests/common.py
(10 hunks)
🧰 Additional context used
🧠 Learnings (31)
📓 Common learnings
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
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.
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.
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_france.py:24-27
Timestamp: 2025-06-18T10:10:46.158Z
Learning: The holidays library prioritizes full test coverage over performance in test suites. Modern library-wide standards favor comprehensive testing across all subdivisions and wide year ranges (e.g., 1803-2050 for France) to ensure thorough validation, even if it creates many test objects.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` where HolidayClass is passed as the first argument. This is the correct signature used across all country test files.
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
Learnt from: PPsyrius
PR: vacanza/holidays#2794
File: tests/calendars/test_julian.py:35-36
Timestamp: 2025-08-12T17:16:54.497Z
Learning: In the vacanza/holidays project calendar tests (Thai, Ethiopian, Julian, etc.), the established testing pattern for validation methods is to use simple for loops like `for year in known_data_dict:` followed by `self.assertEqual(expected, actual)` without using unittest's subTest feature. This pattern is consistently maintained across all calendar test files.
Learnt from: PPsyrius
PR: vacanza/holidays#2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.725Z
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.
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.
📚 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/common.py
📚 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/common.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/common.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
Applied to files:
tests/common.py
📚 Learning: 2025-08-28T02:42:52.725Z
Learnt from: PPsyrius
PR: vacanza/holidays#2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.725Z
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:
tests/common.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/common.py
📚 Learning: 2025-06-13T15:15:25.159Z
Learnt from: KJhellico
PR: vacanza/holidays#2609
File: tests/countries/test_nauru.py:20-24
Timestamp: 2025-06-13T15:15:25.159Z
Learning: In the vacanza/holidays test suite, overriding `setUpClass` is intentionally done with the single `cls` parameter (no *args/**kwargs), so signature-mismatch lint warnings are ignored project-wide.
Applied to files:
tests/common.py
📚 Learning: 2025-06-16T15:48:48.680Z
Learnt from: PPsyrius
PR: vacanza/holidays#2615
File: tests/countries/test_anguilla.py:1-12
Timestamp: 2025-06-16T15:48:48.680Z
Learning: Test files in the holidays repository follow a standardized structure without module or class docstrings. All country test files use the same pattern: license header, imports, and class definition (`class Test{Country}(CommonCountryTests, TestCase):`) without docstrings. This is an established codebase convention that should be maintained for consistency.
Applied to files:
tests/common.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
tests/common.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
PR: vacanza/holidays#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/common.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/common.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
tests/common.py
📚 Learning: 2025-04-02T18:38:35.164Z
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
Applied to files:
tests/common.py
📚 Learning: 2025-05-09T18:36:09.607Z
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Applied to files:
tests/common.py
📚 Learning: 2025-05-12T15:31:58.079Z
Learnt from: KJhellico
PR: vacanza/holidays#2532
File: tests/countries/test_cocos_islands.py:78-89
Timestamp: 2025-05-12T15:31:58.079Z
Learning: In the holidays project, tests for movable holidays (like Easter Monday) should always use static date sets only, not calculation functions.
Applied to files:
tests/common.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-06-14T10:58:43.636Z
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.
Applied to files:
tests/common.py
📚 Learning: 2025-08-03T13:48:11.910Z
Learnt from: KJhellico
PR: vacanza/holidays#2777
File: holidays/countries/gambia.py:120-122
Timestamp: 2025-08-03T13:48:11.910Z
Learning: When reviewing holiday implementations in the holidays library, defer to the maintainers' choice of start years for specific holiday policies, as they likely have access to more reliable primary sources and official documentation than what can be found through web searches.
Applied to files:
tests/common.py
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
tests/common.py
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-04-23T09:59:19.886Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-06-25T10:39:18.504Z
Learnt from: PPsyrius
PR: vacanza/holidays#2678
File: tests/countries/test_american_samoa.py:83-107
Timestamp: 2025-06-25T10:39:18.504Z
Learning: In the holidays library, test methods (especially localization test methods like test_l10n_th, test_l10n_default) do not require docstrings as this is the standard library-wide approach.
Applied to files:
tests/common.py
📚 Learning: 2025-06-25T10:36:39.909Z
Learnt from: PPsyrius
PR: vacanza/holidays#2678
File: tests/countries/test_united_states_virgin_islands.py:59-84
Timestamp: 2025-06-25T10:36:39.909Z
Learning: In the holidays library, test methods typically do not have docstrings. Only special test methods that need specific explanation (like edge cases or unique behaviors) have docstrings. Regular test methods like test_l10n_default, test_l10n_th, test_government_holidays, etc. should not have docstrings added.
Applied to files:
tests/common.py
📚 Learning: 2025-06-14T20:46:32.773Z
Learnt from: KJhellico
PR: vacanza/holidays#2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T20:46:32.773Z
Learning: In the vacanza/holidays project tests, inner classes that shadow outer test class names are not standard practice. The test_sint_maarten.py file appears to be the only file using this pattern, making it an outlier rather than following project conventions.
Applied to files:
tests/common.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` where HolidayClass is passed as the first argument. This is the correct signature used across all country test files.
Applied to files:
tests/common.py
📚 Learning: 2025-06-15T15:24:53.055Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/common.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/common.py
📚 Learning: 2025-08-30T12:49:19.654Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:49:19.654Z
Learning: The assertLocalizedHolidays method in the vacanza/holidays project requires a complete list of all holidays for the specific year being tested, not just a subset. When testing localization, all holidays from that year must be included in the assertion.
Applied to files:
tests/common.py
📚 Learning: 2025-08-30T12:52:58.513Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:52:58.513Z
Learning: In the NSE holidays implementation, assertLocalizedHolidays should only include holidays that are actually observed (trading holidays), not holidays that fall on weekends and are excluded by the observed_rule. For example, Eid al-Fitr 2023 falls on Saturday and is correctly excluded from localization tests.
Applied to files:
tests/common.py
📚 Learning: 2025-03-23T16:59:25.794Z
Learnt from: PPsyrius
PR: vacanza/holidays#2362
File: tests/test_ical.py:31-40
Timestamp: 2025-03-23T16:59:25.794Z
Learning: In the holidays library's `TestIcalExporter` class, initializing `ICalExporter` with `None` is intentional. Using a mock object instead breaks tests because the constructor performs attribute validation with `getattr(self.holidays, "language", None)` which returns a mock with a mock object instead of `None`, causing validation failures. The approach isolates file operation tests from iCal generation logic.
Applied to files:
tests/common.py
🧬 Code graph analysis (1)
tests/common.py (7)
holidays/holiday_base.py (3)
HolidayBase
(57-1296)get_named
(988-1044)get
(946-969)tests/financial/test_national_stock_exchange_of_india.py (1)
setUpClass
(25-27)tests/countries/test_azerbaijan.py (1)
setUpClass
(22-25)tests/countries/test_lebanon.py (1)
setUpClass
(22-27)tests/countries/test_china.py (1)
setUpClass
(22-23)tests/countries/test_canada.py (1)
setUpClass
(22-44)holidays/observed_holiday_base.py (1)
ObservedHolidayBase
(102-246)
⏰ 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.14 on windows-latest
- GitHub Check: Test Python 3.11 on windows-latest
- GitHub Check: Test Python 3.13 on windows-latest
🔇 Additional comments (1)
tests/common.py (1)
147-179
: LGTM on variant fixture generation.Sane defaults, correct PUBLIC exclusion, and observed/islamic variants are wired properly.
9f0aa54
to
6d3bf12
Compare
I've accidentally merge the wrong branch earlier - unrelated changes are now properly excluded again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
tests/countries/test_kyrgyzstan.py (1)
27-46
: Optional: add no-estimated variant checks for Islamic holidays.Consider also asserting names without “(estimated)” using Kyrgyzstan(years=..., islamic_show_estimated=False) to cover both paths.
tests/countries/test_taiwan.py (1)
135-153
: Define missing category-specific assertion wrappers
assertGovernmentHolidayName
,assertSchoolHolidayName
(and the other category helpers) aren’t defined in tests/common.py; add these methods to CommonCountryTests (or update the generator) so the new tests won’t break.tests/common.py (2)
289-306
: Fix: parse() can raise; safely detect date-like strings.Calling dateutil.parser.parse(arg) in an or-expression can throw on non-strings, crashing tests. Use try/except or type-check first.
@@ def _assertHolidayName(self, name, instance_name, *args): # noqa: N802 - elif isinstance(arg, date) or parse(arg): # Exact date check. - for dt in items: - self.assertIn(name, holidays.get_list(dt), dt) + else: + # Exact date check for date or date-like string. + is_date_like = False + if isinstance(arg, date): + is_date_like = True + elif isinstance(arg, str): + try: + parse(arg) + is_date_like = True + except Exception: + is_date_like = False + if is_date_like: + for dt in items: + self.assertIn(name, holidays.get_list(dt), dt) + else: + raise ValueError(f"The {arg} wasn't caught by `assertHolidayName()`") @@ def _assertNoHolidayName(self, name, instance_name, *args): # noqa: N802 - elif isinstance(arg, date) or parse(arg): # Exact date check. - for dt in items: - self.assertNotIn(name, holidays.get_list(dt), dt) - else: - raise ValueError(f"The {arg} wasn't caught by `assertNoHolidayName()`") + else: + # Exact date check for date or date-like string. + is_date_like = False + if isinstance(arg, date): + is_date_like = True + elif isinstance(arg, str): + try: + parse(arg) + is_date_like = True + except Exception: + is_date_like = False + if is_date_like: + for dt in items: + self.assertNotIn(name, holidays.get_list(dt), dt) + else: + raise ValueError(f"The {arg} wasn't caught by `assertNoHolidayName()`")Also applies to: 356-375
388-413
: Bug: assertLocalizedHolidays passes year as str and assumes supported_categories.
- years is a string; should be int.
- categories access can raise AttributeError when the entity has no supported_categories; default to PUBLIC.
- Reuse the same categories for subdivision updates.
- def _assertLocalizedHolidays(self, localized_holidays, language=None): # noqa: N802 + def _assertLocalizedHolidays(self, localized_holidays, language=None): # noqa: N802 @@ - instance = self.test_class( - years=localized_holidays[0][0].split("-")[0], - language=language, - categories=self.test_class.supported_categories, - ) + year = int(localized_holidays[0][0].split("-")[0]) + categories = getattr(self.test_class, "supported_categories", PUBLIC) + instance = self.test_class(years=year, language=language, categories=categories) @@ - instance.update( - self.test_class( - subdiv=subdiv, - years=instance.years, - language=language, - categories=instance.supported_categories, - ) - ) + instance.update( + self.test_class( + subdiv=subdiv, + years=instance.years, + language=language, + categories=categories, + ) + )
♻️ Duplicate comments (1)
tests/common.py (1)
37-91
: Set readable metadata on generated assertion methods for clearer tracebacks.Attach name/qualname/doc to synthesized methods so failures are self-explanatory.
@@ - setattr(cls, method_name, make_assert(helper, attr_name)) + fn = make_assert(helper, attr_name) + # Improve traceback/debuggability. + fn.__name__ = method_name + fn.__qualname__ = f"{cls.__name__}.{method_name}" + fn.__doc__ = getattr(helper, "__doc__", None) + setattr(cls, method_name, fn)Additionally (outside this hunk), consider using functools.wraps on _method to copy metadata from the helper before overriding name/qualname.
from functools import wraps # add at top # then inside each make_assert: @wraps(helper_func) def _method(...): ...
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (33)
holidays/countries/serbia.py
(2 hunks)snapshots/countries/RS_COMMON.json
(0 hunks)tests/common.py
(10 hunks)tests/countries/test_bangladesh.py
(1 hunks)tests/countries/test_belgium.py
(3 hunks)tests/countries/test_burkina_faso.py
(1 hunks)tests/countries/test_chad.py
(1 hunks)tests/countries/test_colombia.py
(12 hunks)tests/countries/test_congo.py
(5 hunks)tests/countries/test_denmark.py
(2 hunks)tests/countries/test_djibouti.py
(1 hunks)tests/countries/test_dominican_republic.py
(5 hunks)tests/countries/test_gabon.py
(1 hunks)tests/countries/test_greenland.py
(2 hunks)tests/countries/test_honduras.py
(5 hunks)tests/countries/test_iran.py
(2 hunks)tests/countries/test_kyrgyzstan.py
(2 hunks)tests/countries/test_luxembourg.py
(3 hunks)tests/countries/test_monaco.py
(4 hunks)tests/countries/test_morocco.py
(2 hunks)tests/countries/test_netherlands.py
(2 hunks)tests/countries/test_nigeria.py
(4 hunks)tests/countries/test_norway.py
(1 hunks)tests/countries/test_serbia.py
(1 hunks)tests/countries/test_singapore.py
(9 hunks)tests/countries/test_solomon_islands.py
(1 hunks)tests/countries/test_taiwan.py
(21 hunks)tests/countries/test_tunisia.py
(1 hunks)tests/financial/test_brasil_bolsa_balcao.py
(6 hunks)tests/financial/test_european_central_bank.py
(4 hunks)tests/financial/test_ice_futures_europe.py
(1 hunks)tests/financial/test_national_stock_exchange_of_india.py
(6 hunks)tests/financial/test_ny_stock_exchange.py
(4 hunks)
💤 Files with no reviewable changes (1)
- snapshots/countries/RS_COMMON.json
🧰 Additional context used
🧠 Learnings (58)
📓 Common learnings
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
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.
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.
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
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.
📚 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_belgium.py
tests/countries/test_burkina_faso.py
tests/countries/test_iran.py
tests/countries/test_norway.py
tests/countries/test_morocco.py
tests/countries/test_monaco.py
tests/financial/test_ice_futures_europe.py
tests/countries/test_tunisia.py
tests/countries/test_congo.py
tests/countries/test_colombia.py
tests/countries/test_singapore.py
tests/countries/test_solomon_islands.py
tests/countries/test_taiwan.py
tests/countries/test_djibouti.py
tests/countries/test_gabon.py
tests/countries/test_greenland.py
tests/countries/test_dominican_republic.py
tests/financial/test_national_stock_exchange_of_india.py
tests/countries/test_luxembourg.py
tests/financial/test_european_central_bank.py
tests/common.py
tests/countries/test_nigeria.py
tests/countries/test_bangladesh.py
tests/countries/test_honduras.py
tests/countries/test_chad.py
tests/countries/test_netherlands.py
tests/financial/test_ny_stock_exchange.py
holidays/countries/serbia.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
tests/countries/test_denmark.py
tests/financial/test_brasil_bolsa_balcao.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_belgium.py
tests/countries/test_burkina_faso.py
tests/countries/test_iran.py
tests/countries/test_norway.py
tests/countries/test_morocco.py
tests/countries/test_monaco.py
tests/countries/test_tunisia.py
tests/countries/test_congo.py
tests/countries/test_colombia.py
tests/countries/test_singapore.py
tests/countries/test_solomon_islands.py
tests/countries/test_taiwan.py
tests/countries/test_djibouti.py
tests/countries/test_gabon.py
tests/countries/test_greenland.py
tests/countries/test_dominican_republic.py
tests/financial/test_national_stock_exchange_of_india.py
tests/countries/test_luxembourg.py
tests/financial/test_european_central_bank.py
tests/common.py
tests/countries/test_bangladesh.py
tests/countries/test_honduras.py
tests/countries/test_chad.py
tests/countries/test_netherlands.py
tests/financial/test_ny_stock_exchange.py
holidays/countries/serbia.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
tests/countries/test_denmark.py
tests/financial/test_brasil_bolsa_balcao.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_belgium.py
tests/countries/test_burkina_faso.py
tests/countries/test_iran.py
tests/countries/test_norway.py
tests/countries/test_morocco.py
tests/countries/test_monaco.py
tests/countries/test_tunisia.py
tests/countries/test_congo.py
tests/countries/test_colombia.py
tests/countries/test_singapore.py
tests/countries/test_solomon_islands.py
tests/countries/test_taiwan.py
tests/countries/test_djibouti.py
tests/countries/test_gabon.py
tests/countries/test_greenland.py
tests/countries/test_dominican_republic.py
tests/financial/test_national_stock_exchange_of_india.py
tests/countries/test_luxembourg.py
tests/financial/test_european_central_bank.py
tests/common.py
tests/countries/test_nigeria.py
tests/countries/test_bangladesh.py
tests/countries/test_honduras.py
tests/countries/test_chad.py
tests/countries/test_netherlands.py
tests/financial/test_ny_stock_exchange.py
holidays/countries/serbia.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
tests/countries/test_denmark.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_belgium.py
tests/countries/test_burkina_faso.py
tests/countries/test_iran.py
tests/countries/test_norway.py
tests/countries/test_morocco.py
tests/countries/test_monaco.py
tests/countries/test_tunisia.py
tests/countries/test_congo.py
tests/countries/test_solomon_islands.py
tests/countries/test_taiwan.py
tests/countries/test_djibouti.py
tests/countries/test_gabon.py
tests/countries/test_greenland.py
tests/countries/test_dominican_republic.py
tests/countries/test_luxembourg.py
tests/financial/test_european_central_bank.py
tests/common.py
tests/countries/test_nigeria.py
tests/countries/test_honduras.py
tests/countries/test_chad.py
tests/countries/test_netherlands.py
tests/countries/test_denmark.py
📚 Learning: 2025-04-02T18:38:35.164Z
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
Applied to files:
tests/countries/test_belgium.py
tests/countries/test_iran.py
tests/countries/test_norway.py
tests/countries/test_morocco.py
tests/countries/test_monaco.py
tests/countries/test_tunisia.py
tests/countries/test_solomon_islands.py
tests/countries/test_djibouti.py
tests/countries/test_greenland.py
tests/countries/test_dominican_republic.py
tests/countries/test_luxembourg.py
tests/common.py
tests/countries/test_netherlands.py
tests/countries/test_denmark.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_belgium.py
tests/countries/test_burkina_faso.py
tests/countries/test_iran.py
tests/countries/test_norway.py
tests/countries/test_morocco.py
tests/countries/test_monaco.py
tests/countries/test_tunisia.py
tests/countries/test_congo.py
tests/countries/test_colombia.py
tests/countries/test_singapore.py
tests/countries/test_solomon_islands.py
tests/countries/test_taiwan.py
tests/countries/test_djibouti.py
tests/countries/test_gabon.py
tests/countries/test_greenland.py
tests/countries/test_dominican_republic.py
tests/countries/test_luxembourg.py
tests/financial/test_european_central_bank.py
tests/countries/test_nigeria.py
tests/countries/test_bangladesh.py
tests/countries/test_honduras.py
tests/countries/test_chad.py
tests/countries/test_netherlands.py
tests/financial/test_ny_stock_exchange.py
tests/countries/test_kyrgyzstan.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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 covered by the test_eid_al_fitr_day() method, which tests both regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
Applied to files:
tests/countries/test_burkina_faso.py
tests/countries/test_iran.py
tests/countries/test_morocco.py
tests/countries/test_tunisia.py
tests/countries/test_solomon_islands.py
tests/countries/test_taiwan.py
tests/countries/test_djibouti.py
tests/countries/test_gabon.py
tests/countries/test_greenland.py
tests/countries/test_nigeria.py
tests/countries/test_honduras.py
tests/countries/test_chad.py
tests/financial/test_ny_stock_exchange.py
tests/countries/test_kyrgyzstan.py
📚 Learning: 2025-04-23T09:59:19.886Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_burkina_faso.py
tests/countries/test_solomon_islands.py
tests/common.py
tests/countries/test_chad.py
holidays/countries/serbia.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
tests/countries/test_burkina_faso.py
tests/countries/test_norway.py
tests/countries/test_singapore.py
tests/countries/test_gabon.py
tests/countries/test_greenland.py
tests/countries/test_dominican_republic.py
tests/financial/test_national_stock_exchange_of_india.py
tests/financial/test_european_central_bank.py
tests/common.py
tests/countries/test_bangladesh.py
tests/countries/test_honduras.py
tests/countries/test_chad.py
tests/countries/test_netherlands.py
tests/financial/test_ny_stock_exchange.py
holidays/countries/serbia.py
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_burkina_faso.py
tests/countries/test_iran.py
tests/countries/test_morocco.py
tests/countries/test_tunisia.py
tests/countries/test_colombia.py
tests/countries/test_singapore.py
tests/countries/test_djibouti.py
tests/common.py
tests/countries/test_nigeria.py
tests/countries/test_bangladesh.py
tests/countries/test_chad.py
tests/countries/test_kyrgyzstan.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
tests/countries/test_iran.py
tests/countries/test_norway.py
tests/countries/test_morocco.py
tests/countries/test_tunisia.py
tests/countries/test_colombia.py
tests/countries/test_singapore.py
tests/countries/test_djibouti.py
tests/financial/test_national_stock_exchange_of_india.py
tests/common.py
tests/countries/test_nigeria.py
tests/countries/test_bangladesh.py
tests/countries/test_honduras.py
tests/countries/test_chad.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
tests/countries/test_denmark.py
📚 Learning: 2025-05-09T18:36:09.607Z
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Applied to files:
tests/countries/test_iran.py
tests/countries/test_norway.py
tests/countries/test_singapore.py
tests/countries/test_taiwan.py
tests/financial/test_national_stock_exchange_of_india.py
tests/common.py
tests/countries/test_honduras.py
tests/financial/test_ny_stock_exchange.py
holidays/countries/serbia.py
tests/countries/test_serbia.py
📚 Learning: 2025-06-14T10:58:43.636Z
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.
Applied to files:
tests/countries/test_norway.py
tests/common.py
holidays/countries/serbia.py
tests/financial/test_brasil_bolsa_balcao.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:
tests/countries/test_morocco.py
tests/countries/test_congo.py
tests/countries/test_colombia.py
tests/countries/test_djibouti.py
tests/countries/test_gabon.py
tests/countries/test_dominican_republic.py
tests/countries/test_luxembourg.py
📚 Learning: 2025-08-28T02:42:52.725Z
Learnt from: PPsyrius
PR: vacanza/holidays#2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.725Z
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:
tests/countries/test_morocco.py
tests/countries/test_colombia.py
tests/countries/test_taiwan.py
tests/countries/test_djibouti.py
tests/countries/test_gabon.py
tests/common.py
tests/countries/test_denmark.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_monaco.py
tests/countries/test_tunisia.py
tests/countries/test_taiwan.py
tests/countries/test_dominican_republic.py
tests/countries/test_luxembourg.py
tests/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
tests/countries/test_denmark.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_monaco.py
tests/countries/test_greenland.py
tests/common.py
tests/countries/test_serbia.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:
tests/countries/test_congo.py
📚 Learning: 2025-08-19T19:47:21.735Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_colombia.py
tests/countries/test_singapore.py
tests/financial/test_national_stock_exchange_of_india.py
tests/financial/test_european_central_bank.py
tests/countries/test_bangladesh.py
tests/countries/test_honduras.py
tests/financial/test_ny_stock_exchange.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
Applied to files:
tests/countries/test_colombia.py
tests/countries/test_taiwan.py
tests/financial/test_national_stock_exchange_of_india.py
tests/financial/test_european_central_bank.py
tests/common.py
tests/countries/test_nigeria.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_singapore.py
tests/countries/test_solomon_islands.py
tests/countries/test_taiwan.py
tests/countries/test_greenland.py
tests/financial/test_national_stock_exchange_of_india.py
tests/financial/test_european_central_bank.py
tests/common.py
tests/countries/test_chad.py
tests/financial/test_ny_stock_exchange.py
tests/countries/test_kyrgyzstan.py
📚 Learning: 2025-07-02T18:21:59.302Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:21:59.302Z
Learning: In the Saint Vincent and the Grenadines holiday tests, for holidays without observed rules that only require a single assertHolidayName call, pass the holiday name directly as a string literal rather than storing it in a variable first for cleaner, more concise code.
Applied to files:
tests/countries/test_solomon_islands.py
tests/countries/test_greenland.py
tests/countries/test_luxembourg.py
tests/countries/test_nigeria.py
tests/countries/test_honduras.py
tests/countries/test_netherlands.py
📚 Learning: 2025-06-16T15:48:48.680Z
Learnt from: PPsyrius
PR: vacanza/holidays#2615
File: tests/countries/test_anguilla.py:1-12
Timestamp: 2025-06-16T15:48:48.680Z
Learning: Test files in the holidays repository follow a standardized structure without module or class docstrings. All country test files use the same pattern: license header, imports, and class definition (`class Test{Country}(CommonCountryTests, TestCase):`) without docstrings. This is an established codebase convention that should be maintained for consistency.
Applied to files:
tests/countries/test_solomon_islands.py
tests/countries/test_taiwan.py
tests/countries/test_djibouti.py
tests/countries/test_dominican_republic.py
tests/common.py
tests/countries/test_nigeria.py
📚 Learning: 2025-08-12T17:16:54.497Z
Learnt from: PPsyrius
PR: vacanza/holidays#2794
File: tests/calendars/test_julian.py:35-36
Timestamp: 2025-08-12T17:16:54.497Z
Learning: In the vacanza/holidays project calendar tests (Thai, Ethiopian, Julian, etc.), the established testing pattern for validation methods is to use simple for loops like `for year in known_data_dict:` followed by `self.assertEqual(expected, actual)` without using unittest's subTest feature. This pattern is consistently maintained across all calendar test files.
Applied to files:
tests/countries/test_solomon_islands.py
tests/financial/test_european_central_bank.py
tests/common.py
tests/financial/test_ny_stock_exchange.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-06-18T10:07:58.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: holidays/countries/french_southern_territories.py:41-44
Timestamp: 2025-06-18T10:07:58.780Z
Learning: Territorial holiday classes that inherit from parent countries (like HolidaysAX from Finland, HolidaysSJ from Norway, HolidaysTF from France) follow a standard pattern of silently overriding self.subdiv in their _populate_public_holidays() method without validation, as this ensures they always use the correct subdivision code for their territory regardless of user input.
Applied to files:
tests/countries/test_solomon_islands.py
📚 Learning: 2025-03-13T15:17:45.519Z
Learnt from: PPsyrius
PR: vacanza/holidays#2349
File: tests/countries/test_taiwan.py:0-0
Timestamp: 2025-03-13T15:17:45.519Z
Learning: For Taiwan's holiday system, different categories (GOVERNMENT, OPTIONAL, SCHOOL, WORKDAY) have distinct uses and contexts, justifying separate instances rather than parameterization in tests.
Applied to files:
tests/countries/test_taiwan.py
📚 Learning: 2025-08-31T09:54:22.072Z
Learnt from: PPsyrius
PR: vacanza/holidays#2874
File: tests/countries/test_taiwan.py:379-381
Timestamp: 2025-08-31T09:54:22.072Z
Learning: In Taiwan's holiday system, some holidays like Women's Day can appear in multiple categories simultaneously. Women's Day appears in the WORKDAY category for regular March 8th dates but also has special observed dates in the OPTIONAL category (1998-2000) when it was moved before Tomb-Sweeping Day. The test cases correctly reflect this dual-category behavior.
Applied to files:
tests/countries/test_taiwan.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_taiwan.py
tests/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
📚 Learning: 2025-04-05T04:33:53.254Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
Applied to files:
tests/countries/test_taiwan.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` where HolidayClass is passed as the first argument. This is the correct signature used across all country test files.
Applied to files:
tests/countries/test_taiwan.py
tests/common.py
tests/countries/test_kyrgyzstan.py
tests/countries/test_serbia.py
📚 Learning: 2025-06-18T10:21:01.376Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_luxembourg.py
📚 Learning: 2025-08-30T12:49:19.654Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:49:19.654Z
Learning: The assertLocalizedHolidays method in the vacanza/holidays project requires a complete list of all holidays for the specific year being tested, not just a subset. When testing localization, all holidays from that year must be included in the assertion.
Applied to files:
tests/countries/test_luxembourg.py
tests/common.py
📚 Learning: 2025-06-13T15:15:25.159Z
Learnt from: KJhellico
PR: vacanza/holidays#2609
File: tests/countries/test_nauru.py:20-24
Timestamp: 2025-06-13T15:15:25.159Z
Learning: In the vacanza/holidays test suite, overriding `setUpClass` is intentionally done with the single `cls` parameter (no *args/**kwargs), so signature-mismatch lint warnings are ignored project-wide.
Applied to files:
tests/common.py
tests/countries/test_kyrgyzstan.py
📚 Learning: 2025-05-12T15:31:58.079Z
Learnt from: KJhellico
PR: vacanza/holidays#2532
File: tests/countries/test_cocos_islands.py:78-89
Timestamp: 2025-05-12T15:31:58.079Z
Learning: In the holidays project, tests for movable holidays (like Easter Monday) should always use static date sets only, not calculation functions.
Applied to files:
tests/common.py
📚 Learning: 2025-08-03T13:48:11.910Z
Learnt from: KJhellico
PR: vacanza/holidays#2777
File: holidays/countries/gambia.py:120-122
Timestamp: 2025-08-03T13:48:11.910Z
Learning: When reviewing holiday implementations in the holidays library, defer to the maintainers' choice of start years for specific holiday policies, as they likely have access to more reliable primary sources and official documentation than what can be found through web searches.
Applied to files:
tests/common.py
holidays/countries/serbia.py
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
tests/common.py
📚 Learning: 2025-06-25T10:39:18.504Z
Learnt from: PPsyrius
PR: vacanza/holidays#2678
File: tests/countries/test_american_samoa.py:83-107
Timestamp: 2025-06-25T10:39:18.504Z
Learning: In the holidays library, test methods (especially localization test methods like test_l10n_th, test_l10n_default) do not require docstrings as this is the standard library-wide approach.
Applied to files:
tests/common.py
📚 Learning: 2025-06-25T10:36:39.909Z
Learnt from: PPsyrius
PR: vacanza/holidays#2678
File: tests/countries/test_united_states_virgin_islands.py:59-84
Timestamp: 2025-06-25T10:36:39.909Z
Learning: In the holidays library, test methods typically do not have docstrings. Only special test methods that need specific explanation (like edge cases or unique behaviors) have docstrings. Regular test methods like test_l10n_default, test_l10n_th, test_government_holidays, etc. should not have docstrings added.
Applied to files:
tests/common.py
📚 Learning: 2025-06-14T20:46:32.773Z
Learnt from: KJhellico
PR: vacanza/holidays#2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T20:46:32.773Z
Learning: In the vacanza/holidays project tests, inner classes that shadow outer test class names are not standard practice. The test_sint_maarten.py file appears to be the only file using this pattern, making it an outlier rather than following project conventions.
Applied to files:
tests/common.py
📚 Learning: 2025-06-15T15:24:53.055Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-09-01T16:07:42.721Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/common.py:103-108
Timestamp: 2025-09-01T16:07:42.721Z
Learning: In the vacanza/holidays test framework, the set_language method in TestCase is an instance method that only sets os.environ["LANGUAGE"] without using self. It can be called unconventionally from setUpClass as cls.set_language(test_class, default_lang) where test_class serves as a dummy self parameter, but this pattern works because self is unused in the method implementation.
Applied to files:
tests/common.py
📚 Learning: 2025-08-30T12:52:58.513Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:52:58.513Z
Learning: In the NSE holidays implementation, assertLocalizedHolidays should only include holidays that are actually observed (trading holidays), not holidays that fall on weekends and are excluded by the observed_rule. For example, Eid al-Fitr 2023 falls on Saturday and is correctly excluded from localization tests.
Applied to files:
tests/common.py
📚 Learning: 2025-03-23T16:59:25.794Z
Learnt from: PPsyrius
PR: vacanza/holidays#2362
File: tests/test_ical.py:31-40
Timestamp: 2025-03-23T16:59:25.794Z
Learning: In the holidays library's `TestIcalExporter` class, initializing `ICalExporter` with `None` is intentional. Using a mock object instead breaks tests because the constructor performs attribute validation with `getattr(self.holidays, "language", None)` which returns a mock with a mock object instead of `None`, causing validation failures. The approach isolates file operation tests from iCal generation logic.
Applied to files:
tests/common.py
📚 Learning: 2025-04-13T19:10:31.502Z
Learnt from: KJhellico
PR: vacanza/holidays#2465
File: holidays/countries/suriname.py:219-251
Timestamp: 2025-04-13T19:10:31.502Z
Learning: The `_CustomIslamicHolidays` classes in this project contain only exact verified holiday dates from reliable sources, rather than calculated or estimated future dates. This is by design to ensure accuracy, particularly for religious holidays that may follow lunar calendars or depend on local observations.
Applied to files:
tests/countries/test_nigeria.py
📚 Learning: 2025-04-23T14:55:35.504Z
Learnt from: PPsyrius
PR: vacanza/holidays#2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.
Applied to files:
tests/countries/test_netherlands.py
holidays/countries/serbia.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#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:
tests/financial/test_ny_stock_exchange.py
holidays/countries/serbia.py
📚 Learning: 2025-06-14T11:04:31.180Z
Learnt from: PPsyrius
PR: vacanza/holidays#2609
File: holidays/countries/nauru.py:57-60
Timestamp: 2025-06-14T11:04:31.180Z
Learning: In the holidays library, the base `HolidayBase._populate()` method already includes a guard clause that prevents holiday population methods like `_populate_public_holidays()` from being called when the year is before `start_year` or after `end_year`. Therefore, individual country implementations do not need to add their own guard clauses for years before independence or other start dates.
Applied to files:
holidays/countries/serbia.py
📚 Learning: 2025-06-14T11:05:21.250Z
Learnt from: PPsyrius
PR: vacanza/holidays#2609
File: holidays/countries/nauru.py:48-50
Timestamp: 2025-06-14T11:05:21.250Z
Learning: In the holidays library, newer implementations use `start_year` to indicate the earliest year with complete holiday data coverage, not necessarily the first year a holiday existed. If a holiday system starts partway through a year (like Nauru's Public Holidays Act starting Jan 31, 1968), the start_year should be set to the following year (1969) to ensure users get full annual holiday coverage.
Applied to files:
holidays/countries/serbia.py
📚 Learning: 2025-04-03T12:36:41.201Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/countries/serbia.py
📚 Learning: 2025-08-25T09:57:22.291Z
Learnt from: PPsyrius
PR: vacanza/holidays#2833
File: holidays/countries/uganda.py:50-56
Timestamp: 2025-08-25T09:57:22.291Z
Learning: In the holidays package, when adding comments for year-restricted holidays in Uganda and similar country modules, include specific legal or historical context such as the actual laws, parliamentary acts, or government decisions that established the holidays, rather than just generic "since YEAR" information. For example, reference the specific Parliament act, decree, or historical event that created the holiday.
Applied to files:
holidays/countries/serbia.py
📚 Learning: 2025-08-11T10:14:28.517Z
Learnt from: PPsyrius
PR: vacanza/holidays#2794
File: holidays/groups/christian.py:328-343
Timestamp: 2025-08-11T10:14:28.517Z
Learning: For Ethiopian holidays in the `holidays/groups/christian.py` file, docstring wording should maintain source-accurate phrasing (e.g., "in coincidence of" for Ethiopian New Year/Enkutatash), even when it might read awkwardly in English, to ensure consistency with official Ethiopian documentation.
Applied to files:
holidays/countries/serbia.py
📚 Learning: 2025-06-18T10:10:46.158Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_france.py:24-27
Timestamp: 2025-06-18T10:10:46.158Z
Learning: The holidays library prioritizes full test coverage over performance in test suites. Modern library-wide standards favor comprehensive testing across all subdivisions and wide year ranges (e.g., 1803-2050 for France) to ensure thorough validation, even if it creates many test objects.
Applied to files:
holidays/countries/serbia.py
📚 Learning: 2025-08-21T04:56:03.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/serbia.py
📚 Learning: 2025-07-08T10:21:37.055Z
Learnt from: KJhellico
PR: vacanza/holidays#2701
File: holidays/countries/palestine.py:122-122
Timestamp: 2025-07-08T10:21:37.055Z
Learning: In Palestine, Easter follows the same naming pattern as Christmas - both the first and second days of Easter have identical names for the respective religious groups (Catholic or Orthodox). The implementation correctly uses `_add_easter_sunday` for nationwide holidays and `_add_easter_monday` for group-specific second days, but both share the same Arabic name "عيد الفصح المجيد".
Applied to files:
holidays/countries/serbia.py
📚 Learning: 2025-08-21T04:56:03.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/serbia.py
📚 Learning: 2025-06-22T21:36:18.015Z
Learnt from: KJhellico
PR: vacanza/holidays#2671
File: tests/countries/test_libya.py:19-24
Timestamp: 2025-06-22T21:36:18.015Z
Learning: In the vacanza/holidays project, test classes for countries do not use docstrings. All test classes follow the same pattern: class declaration directly followed by classmethod def setUpClass(cls) without any docstrings for the class or methods.
Applied to files:
tests/countries/test_kyrgyzstan.py
📚 Learning: 2025-08-20T19:46:15.625Z
Learnt from: KJhellico
PR: vacanza/holidays#2833
File: tests/countries/test_uganda.py:15-0
Timestamp: 2025-08-20T19:46:15.625Z
Learning: In the holidays project, the standard import pattern for country test files is `from holidays.countries.<country> import Country, CODE1, CODE2` (direct module import), used by ~75% of country test files. Only a minority (~25%) use the aggregated public API import `from holidays.countries import Country, CODE1, CODE2`. The direct module import pattern should be used for new country test files to follow the established convention.
Applied to files:
tests/countries/test_denmark.py
🧬 Code graph analysis (27)
tests/countries/test_burkina_faso.py (1)
holidays/countries/burkina_faso.py (1)
BurkinaFaso
(19-100)
tests/countries/test_iran.py (1)
holidays/countries/iran.py (1)
Iran
(35-153)
tests/countries/test_norway.py (1)
holidays/countries/norway.py (1)
Norway
(20-130)
tests/countries/test_morocco.py (1)
holidays/countries/morocco.py (1)
Morocco
(19-107)
tests/countries/test_monaco.py (1)
holidays/countries/monaco.py (1)
Monaco
(20-78)
tests/financial/test_ice_futures_europe.py (1)
holidays/financial/ice_futures_europe.py (1)
ICEFuturesEurope
(17-41)
tests/countries/test_tunisia.py (1)
holidays/countries/tunisia.py (1)
Tunisia
(19-85)
tests/countries/test_congo.py (1)
holidays/countries/congo.py (1)
Congo
(19-71)
tests/countries/test_colombia.py (1)
holidays/countries/colombia.py (1)
Colombia
(19-112)
tests/countries/test_singapore.py (1)
holidays/countries/singapore.py (1)
Singapore
(34-146)
tests/countries/test_taiwan.py (2)
tests/financial/test_national_stock_exchange_of_india.py (1)
setUpClass
(25-27)holidays/countries/taiwan.py (1)
Taiwan
(48-278)
tests/countries/test_djibouti.py (1)
holidays/countries/djibouti.py (1)
Djibouti
(20-82)
tests/countries/test_gabon.py (1)
holidays/countries/gabon.py (1)
Gabon
(19-86)
tests/countries/test_greenland.py (1)
holidays/countries/greenland.py (1)
Greenland
(20-90)
tests/countries/test_dominican_republic.py (1)
holidays/countries/dominican_republic.py (1)
DominicanRepublic
(24-84)
tests/financial/test_national_stock_exchange_of_india.py (2)
tests/countries/test_taiwan.py (1)
setUpClass
(22-24)holidays/financial/national_stock_exchange_of_india.py (1)
NationalStockExchangeOfIndia
(21-130)
tests/countries/test_luxembourg.py (1)
holidays/countries/luxembourg.py (1)
Luxembourg
(20-81)
tests/financial/test_european_central_bank.py (2)
tests/countries/test_nigeria.py (2)
setUpClass
(21-23)test_good_friday
(51-62)holidays/financial/european_central_bank.py (1)
EuropeanCentralBank
(18-48)
tests/countries/test_nigeria.py (7)
tests/countries/test_azerbaijan.py (1)
setUpClass
(22-25)tests/countries/test_burundi.py (1)
setUpClass
(21-24)tests/countries/test_pakistan.py (1)
setUpClass
(21-24)tests/countries/test_uzbekistan.py (1)
setUpClass
(21-24)tests/countries/test_north_macedonia.py (1)
setUpClass
(33-49)tests/countries/test_philippines.py (1)
setUpClass
(22-26)holidays/countries/nigeria.py (1)
Nigeria
(26-135)
tests/countries/test_honduras.py (1)
holidays/countries/honduras.py (1)
Honduras
(19-77)
tests/countries/test_chad.py (1)
holidays/countries/chad.py (1)
Chad
(24-96)
tests/countries/test_netherlands.py (1)
holidays/countries/netherlands.py (1)
Netherlands
(20-92)
tests/financial/test_ny_stock_exchange.py (5)
holidays/calendars/gregorian.py (1)
_timedelta
(37-42)holidays/financial/ny_stock_exchange.py (3)
NewYorkStockExchange
(34-139)XNYS
(142-143)NYSE
(146-147)tests/countries/test_nigeria.py (1)
setUpClass
(21-23)tests/financial/test_brasil_bolsa_balcao.py (1)
setUpClass
(21-23)tests/financial/test_ice_futures_europe.py (2)
setUpClass
(21-22)test_2023
(44-50)
tests/countries/test_kyrgyzstan.py (2)
tests/countries/test_dominican_republic.py (2)
setUpClass
(21-22)test_2022
(64-79)holidays/countries/kyrgyzstan.py (3)
Kyrgyzstan
(18-88)KG
(91-92)KGZ
(95-96)
tests/countries/test_serbia.py (2)
tests/financial/test_ny_stock_exchange.py (4)
setUpClass
(23-25)test_no_holidays
(30-31)test_new_years_day
(33-54)test_labor_day
(178-190)tests/countries/test_montenegro.py (5)
setUpClass
(22-28)test_no_holidays
(33-36)test_new_years_day
(38-53)test_statehood_day
(89-104)test_labor_day
(55-70)
tests/countries/test_denmark.py (1)
holidays/countries/denmark.py (1)
Denmark
(20-85)
tests/financial/test_brasil_bolsa_balcao.py (3)
tests/countries/test_nigeria.py (1)
setUpClass
(21-23)tests/financial/test_ny_stock_exchange.py (1)
setUpClass
(23-25)holidays/financial/brasil_bolsa_balcao.py (1)
BrasilBolsaBalcao
(19-101)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (2)
tests/financial/test_brasil_bolsa_balcao.py (1)
81-82
: Avoid non-deterministic set iteration in generatorIterate cls.full_range in order and filter out exceptions.
- self.assertHolidayName( - name, (f"{year}-04-21" for year in set(self.full_range).difference({1931, 1932})) - ) + self.assertHolidayName( + name, (f"{year}-04-21" for year in self.full_range if year not in (1931, 1932)) + )tests/financial/test_european_central_bank.py (1)
75-76
: Rename resolved.
test_christmas_holiday
addresses the earlier nit about the method name.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (5)
tests/financial/test_brasil_bolsa_balcao.py
(5 hunks)tests/financial/test_european_central_bank.py
(3 hunks)tests/financial/test_ice_futures_europe.py
(1 hunks)tests/financial/test_national_stock_exchange_of_india.py
(14 hunks)tests/financial/test_ny_stock_exchange.py
(3 hunks)
🧰 Additional context used
🧠 Learnings (25)
📓 Common learnings
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
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.
Learnt from: KJhellico
PR: vacanza/holidays#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
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.
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.
📚 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/financial/test_ice_futures_europe.py
tests/financial/test_national_stock_exchange_of_india.py
tests/financial/test_ny_stock_exchange.py
tests/financial/test_european_central_bank.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
Applied to files:
tests/financial/test_ice_futures_europe.py
tests/financial/test_european_central_bank.py
tests/financial/test_brasil_bolsa_balcao.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/financial/test_ice_futures_europe.py
tests/financial/test_national_stock_exchange_of_india.py
tests/financial/test_ny_stock_exchange.py
tests/financial/test_european_central_bank.py
tests/financial/test_brasil_bolsa_balcao.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/financial/test_national_stock_exchange_of_india.py
tests/financial/test_ny_stock_exchange.py
tests/financial/test_european_central_bank.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-08-26T20:10:05.288Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/financial/test_national_stock_exchange_of_india.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
tests/financial/test_national_stock_exchange_of_india.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/financial/test_national_stock_exchange_of_india.py
tests/financial/test_european_central_bank.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/financial/test_national_stock_exchange_of_india.py
tests/financial/test_european_central_bank.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-08-19T19:47:21.735Z
Learnt from: KJhellico
PR: vacanza/holidays#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/financial/test_national_stock_exchange_of_india.py
tests/financial/test_european_central_bank.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
PR: vacanza/holidays#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/financial/test_national_stock_exchange_of_india.py
tests/financial/test_ny_stock_exchange.py
tests/financial/test_european_central_bank.py
📚 Learning: 2025-05-09T18:36:09.607Z
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Applied to files:
tests/financial/test_national_stock_exchange_of_india.py
tests/financial/test_ny_stock_exchange.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#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:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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/financial/test_ny_stock_exchange.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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 covered by the test_eid_al_fitr_day() method, which tests both regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
Applied to files:
tests/financial/test_ny_stock_exchange.py
📚 Learning: 2025-08-12T17:16:54.497Z
Learnt from: PPsyrius
PR: vacanza/holidays#2794
File: tests/calendars/test_julian.py:35-36
Timestamp: 2025-08-12T17:16:54.497Z
Learning: In the vacanza/holidays project calendar tests (Thai, Ethiopian, Julian, etc.), the established testing pattern for validation methods is to use simple for loops like `for year in known_data_dict:` followed by `self.assertEqual(expected, actual)` without using unittest's subTest feature. This pattern is consistently maintained across all calendar test files.
Applied to files:
tests/financial/test_ny_stock_exchange.py
tests/financial/test_european_central_bank.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/financial/test_european_central_bank.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/financial/test_european_central_bank.py
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-07-02T18:21:59.302Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:21:59.302Z
Learning: In the Saint Vincent and the Grenadines holiday tests, for holidays without observed rules that only require a single assertHolidayName call, pass the holiday name directly as a string literal rather than storing it in a variable first for cleaner, more concise code.
Applied to files:
tests/financial/test_european_central_bank.py
📚 Learning: 2025-05-13T13:23:11.375Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/financial/test_european_central_bank.py
📚 Learning: 2025-04-02T18:38:35.164Z
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
Applied to files:
tests/financial/test_european_central_bank.py
📚 Learning: 2025-06-14T20:46:32.773Z
Learnt from: KJhellico
PR: vacanza/holidays#2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T20:46:32.773Z
Learning: In the vacanza/holidays project tests, inner classes that shadow outer test class names are not standard practice. The test_sint_maarten.py file appears to be the only file using this pattern, making it an outlier rather than following project conventions.
Applied to files:
tests/financial/test_european_central_bank.py
📚 Learning: 2025-06-14T10:58:43.636Z
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.
Applied to files:
tests/financial/test_brasil_bolsa_balcao.py
📚 Learning: 2025-04-05T04:33:53.254Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
Applied to files:
tests/financial/test_brasil_bolsa_balcao.py
🧬 Code graph analysis (5)
tests/financial/test_ice_futures_europe.py (3)
tests/financial/test_brasil_bolsa_balcao.py (2)
setUpClass
(21-23)test_no_holidays
(28-29)holidays/financial/ice_futures_europe.py (2)
ICEFuturesEurope
(17-41)IFEU
(44-45)tests/common.py (1)
assertAliases
(248-257)
tests/financial/test_national_stock_exchange_of_india.py (5)
holidays/financial/national_stock_exchange_of_india.py (3)
XNSE
(133-134)NationalStockExchangeOfIndia
(21-130)NSE
(137-138)tests/financial/test_brasil_bolsa_balcao.py (1)
setUpClass
(21-23)tests/financial/test_european_central_bank.py (1)
setUpClass
(21-23)tests/financial/test_ny_stock_exchange.py (1)
setUpClass
(23-25)tests/common.py (2)
setUpClass
(93-180)assertAliases
(248-257)
tests/financial/test_ny_stock_exchange.py (3)
holidays/calendars/gregorian.py (1)
_timedelta
(37-42)holidays/financial/ny_stock_exchange.py (3)
NewYorkStockExchange
(34-139)XNYS
(142-143)NYSE
(146-147)tests/common.py (3)
CommonFinancialTests
(490-495)TestCase
(33-426)setUpClass
(93-180)
tests/financial/test_european_central_bank.py (2)
holidays/financial/european_central_bank.py (4)
XECB
(51-52)EuropeanCentralBank
(18-48)ECB
(55-56)TAR
(59-60)tests/common.py (1)
assertAliases
(248-257)
tests/financial/test_brasil_bolsa_balcao.py (2)
holidays/financial/brasil_bolsa_balcao.py (3)
BVMF
(104-105)BrasilBolsaBalcao
(19-101)B3
(108-109)tests/financial/test_european_central_bank.py (1)
setUpClass
(21-23)
⏰ 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). (1)
- GitHub Check: Test Python 3.13 on windows-latest
🔇 Additional comments (27)
tests/financial/test_brasil_bolsa_balcao.py (13)
22-23
: setUpClass full_range wiring looks goodPattern matches existing financial tests; passing the base class with an explicit years range is correct.
29-29
: Pre-start-year empty instance check is correctUsing start_year - 1 to assert no holidays is precise.
33-33
: Universal Fraternization across full_range is fineDeterministic year generator via cls.full_range.
63-64
: Holy Thursday boundary is correctCovers 1890–1999 inclusive; absent from 2000+.
76-76
: Good Friday over full_range is fineMatches provider behavior.
88-88
: Worker’s Day pre-1925 absence check is correctAligns with provider’s year gate.
100-100
: Corpus Christi over full_range is correctConsistent with implementation.
104-104
: Independence Day generator over full_range is correctDeterministic coverage.
109-109
: Our Lady of Aparecida pre-1980 absence is correctMatches law-based start year.
113-113
: All Souls’ Day over full_range is correct
117-117
: Republic Proclamation Day over full_range is correct
122-122
: Zumbi/Black Awareness pre-2024 absence is correct
127-127
: Christmas pre-1922 absence is correcttests/financial/test_ice_futures_europe.py (2)
22-22
: Good: tie test range to implementation start_year.Switching to
IFEU.start_year
removes drift risk.
28-28
: Correct: pre-start-year negative test updated.Using
IFEU.start_year - 1
is precise.tests/financial/test_european_central_bank.py (4)
22-24
: Solid: centralized full_range and setup.Matches the new common pattern and reduces duplication.
28-29
: Accurate pre-start-year check.
XECB.start_year - 1
is the right sentinel.
34-36
: Clearer naming and range-driven assertion.Renaming to
test_new_years_day
and usingself.full_range
is consistent.
39-52
: Range coverage + anchor dates look good.Keeping exemplar dates alongside range checks improves debuggability without sacrificing breadth.
Also applies to: 55-68, 70-76
tests/financial/test_ny_stock_exchange.py (5)
16-16
: Import cleanup is tighter and sufficient.Only the needed constants are imported; no accidental drops.
24-26
: Good: adopt full_range + common setup.Brings XNYS tests in line with the shared infra.
33-55
: Nice coverage for New Year’s edge cases.
- Confirms observed Mondays.
- Guards against Dec 31 carry-back.
111-124
: Correct handling of Good Friday exceptions.Explicitly excluding 1898, 1906, 1907 and asserting absence is spot on.
385-398
: Useful year snapshot.Adds a concise 2023 end-to-end verification.
tests/financial/test_national_stock_exchange_of_india.py (3)
26-27
: Good: dynamic full_range tied to XNSE.start_year.Capped at 2050 per project guidance for these calendars.
35-42
: Weekend guardrails are appropriate.The explicit
assertNoHoliday(...)
on weekend dates complements non-observed checks and prevents false positives when no observed move applies.Also applies to: 54-61, 63-69, 71-77, 79-85, 87-93, 104-107, 129-131, 143-146, 158-160, 172-174, 186-188, 200-202, 214-216
227-227
: Nice use of islamic_no_estimated + non_observed helpers.This aligns with the new syntactic-sugar API and trims boilerplate.
Also applies to: 242-242, 256-256
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: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/countries/test_argentina.py (1)
1143-1155
: Use the simpler generated helper name for Islamic “no-estimated” variants.assertIslamicIslamicNoEstimatedHolidayName indicates duplicate variant generation (islamic + islamic_no_estimated). Prefer assertIslamicNoEstimatedHolidayName for clarity and stability.
Apply the replacements below:
- self.assertIslamicIslamicNoEstimatedHolidayName( + self.assertIslamicNoEstimatedHolidayName( name, "2019-08-31", "2020-08-20", "2021-08-08", "2022-07-30", "2023-07-19", "2024-07-07", "2025-06-26", ) - self.assertIslamicIslamicNoEstimatedHolidayName(name, range(1997, 2050)) - self.assertNoIslamicIslamicNoEstimatedHolidayName(name, range(AR.start_year, 1997)) + self.assertIslamicNoEstimatedHolidayName(name, range(1997, 2050)) + self.assertNoIslamicNoEstimatedHolidayName(name, range(AR.start_year, 1997)) @@ - self.assertIslamicIslamicNoEstimatedHolidayName( + self.assertIslamicNoEstimatedHolidayName( name, "2019-06-04", "2020-05-24", "2021-05-13", "2022-05-02", "2023-04-21", "2024-04-10", "2025-03-31", ) - self.assertIslamicIslamicNoEstimatedHolidayName(name, range(1997, 2050)) - self.assertNoIslamicIslamicNoEstimatedHolidayName(name, range(AR.start_year, 1997)) + self.assertIslamicNoEstimatedHolidayName(name, range(1997, 2050)) + self.assertNoIslamicNoEstimatedHolidayName(name, range(AR.start_year, 1997)) @@ - self.assertIslamicIslamicNoEstimatedHolidayName( + self.assertIslamicNoEstimatedHolidayName( name, "2019-08-11", "2020-07-31", "2021-07-20", "2022-07-09", "2023-06-28", "2024-06-16", "2025-06-10", ) - self.assertIslamicIslamicNoEstimatedHolidayName(name, range(1997, 2050)) - self.assertNoIslamicIslamicNoEstimatedHolidayName(name, range(AR.start_year, 1997)) + self.assertIslamicNoEstimatedHolidayName(name, range(1997, 2050)) + self.assertNoIslamicNoEstimatedHolidayName(name, range(AR.start_year, 1997))Follow-up (optional): de-duplicate variant generation in tests/common.py to avoid creating both holidays_islamic_no_estimated and holidays_islamic_islamic_no_estimated. I can draft that change if you want.
Also applies to: 1158-1169, 1174-1185
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (16)
holidays/countries/algeria.py
(3 hunks)tests/common.py
(10 hunks)tests/countries/test_afghanistan.py
(10 hunks)tests/countries/test_albania.py
(6 hunks)tests/countries/test_algeria.py
(1 hunks)tests/countries/test_american_samoa.py
(1 hunks)tests/countries/test_andorra.py
(14 hunks)tests/countries/test_angola.py
(14 hunks)tests/countries/test_anguilla.py
(15 hunks)tests/countries/test_antigua_and_barbuda.py
(11 hunks)tests/countries/test_argentina.py
(60 hunks)tests/countries/test_armenia.py
(3 hunks)tests/countries/test_aruba.py
(9 hunks)tests/countries/test_australia.py
(18 hunks)tests/countries/test_austria.py
(6 hunks)tests/countries/test_azerbaijan.py
(4 hunks)
🧰 Additional context used
🧠 Learnings (64)
📓 Common learnings
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
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.
Learnt from: KJhellico
PR: vacanza/holidays#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
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.
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.
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.725Z
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/financial/test_ice_futures_europe.py:22-22
Timestamp: 2025-09-02T08:02:03.573Z
Learning: In the vacanza/holidays project, cls.full_range should only be introduced in financial test classes when there are test methods that actually iterate over or use the full year range. For test classes like ICEFuturesEurope that only have year-specific tests (e.g., test_2021, test_2022), using the range directly in setUpClass is preferred to avoid premature abstraction.
Learnt from: KJhellico
PR: vacanza/holidays#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.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_france.py:24-27
Timestamp: 2025-06-18T10:10:46.158Z
Learning: The holidays library prioritizes full test coverage over performance in test suites. Modern library-wide standards favor comprehensive testing across all subdivisions and wide year ranges (e.g., 1803-2050 for France) to ensure thorough validation, even if it creates many test objects.
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.
📚 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_american_samoa.py
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/countries/test_armenia.py
tests/common.py
tests/countries/test_azerbaijan.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_algeria.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 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_american_samoa.py
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/countries/test_armenia.py
tests/common.py
tests/countries/test_azerbaijan.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_algeria.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_american_samoa.py
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/common.py
tests/countries/test_azerbaijan.py
tests/countries/test_argentina.py
tests/countries/test_algeria.py
tests/countries/test_austria.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
tests/countries/test_american_samoa.py
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/common.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_american_samoa.py
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/common.py
tests/countries/test_azerbaijan.py
tests/countries/test_argentina.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_angola.py
tests/countries/test_australia.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_american_samoa.py
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/countries/test_armenia.py
tests/common.py
tests/countries/test_azerbaijan.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_algeria.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-06-14T10:58:43.636Z
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.
Applied to files:
tests/countries/test_american_samoa.py
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/countries/test_armenia.py
tests/common.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-06-14T11:04:31.180Z
Learnt from: PPsyrius
PR: vacanza/holidays#2609
File: holidays/countries/nauru.py:57-60
Timestamp: 2025-06-14T11:04:31.180Z
Learning: In the holidays library, the base `HolidayBase._populate()` method already includes a guard clause that prevents holiday population methods like `_populate_public_holidays()` from being called when the year is before `start_year` or after `end_year`. Therefore, individual country implementations do not need to add their own guard clauses for years before independence or other start dates.
Applied to files:
tests/countries/test_american_samoa.py
holidays/countries/algeria.py
tests/countries/test_armenia.py
tests/countries/test_argentina.py
tests/countries/test_anguilla.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
tests/countries/test_american_samoa.py
tests/common.py
tests/countries/test_azerbaijan.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_algeria.py
tests/countries/test_anguilla.py
tests/countries/test_afghanistan.py
tests/countries/test_australia.py
📚 Learning: 2025-09-02T08:02:03.573Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/financial/test_ice_futures_europe.py:22-22
Timestamp: 2025-09-02T08:02:03.573Z
Learning: In the vacanza/holidays project, cls.full_range should only be introduced in financial test classes when there are test methods that actually iterate over or use the full year range. For test classes like ICEFuturesEurope that only have year-specific tests (e.g., test_2021, test_2022), using the range directly in setUpClass is preferred to avoid premature abstraction.
Applied to files:
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/countries/test_armenia.py
tests/common.py
tests/countries/test_azerbaijan.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-05-09T18:36:09.607Z
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Applied to files:
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_armenia.py
tests/common.py
tests/countries/test_albania.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_angola.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_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/countries/test_armenia.py
tests/common.py
tests/countries/test_azerbaijan.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_algeria.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
tests/countries/test_australia.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_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/countries/test_armenia.py
tests/common.py
tests/countries/test_azerbaijan.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_algeria.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
Applied to files:
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_armenia.py
tests/common.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-04-05T04:33:53.254Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
Applied to files:
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/countries/test_armenia.py
tests/countries/test_azerbaijan.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_algeria.py
tests/countries/test_anguilla.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` where HolidayClass is passed as the first argument. This is the correct signature used across all country test files.
Applied to files:
tests/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/common.py
tests/countries/test_albania.py
tests/countries/test_anguilla.py
tests/countries/test_afghanistan.py
tests/countries/test_australia.py
📚 Learning: 2025-08-19T19:47:21.735Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/countries/test_armenia.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_anguilla.py
tests/countries/test_austria.py
tests/countries/test_australia.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_antigua_and_barbuda.py
tests/countries/test_aruba.py
tests/countries/test_andorra.py
holidays/countries/algeria.py
tests/countries/test_azerbaijan.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_algeria.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-07-02T18:21:59.302Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:21:59.302Z
Learning: In the Saint Vincent and the Grenadines holiday tests, for holidays without observed rules that only require a single assertHolidayName call, pass the holiday name directly as a string literal rather than storing it in a variable first for cleaner, more concise code.
Applied to files:
tests/countries/test_aruba.py
tests/common.py
📚 Learning: 2025-08-30T12:49:19.654Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:49:19.654Z
Learning: The assertLocalizedHolidays method in the vacanza/holidays project requires a complete list of all holidays for the specific year being tested, not just a subset. When testing localization, all holidays from that year must be included in the assertion.
Applied to files:
tests/countries/test_aruba.py
tests/countries/test_andorra.py
tests/common.py
📚 Learning: 2025-08-28T02:42:52.725Z
Learnt from: PPsyrius
PR: vacanza/holidays#2863
File: tests/countries/test_georgia.py:31-36
Timestamp: 2025-08-28T02:42:52.725Z
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:
tests/countries/test_andorra.py
tests/common.py
tests/countries/test_azerbaijan.py
tests/countries/test_argentina.py
📚 Learning: 2025-05-04T10:29:46.780Z
Learnt from: KJhellico
PR: vacanza/holidays#2525
File: holidays/countries/togo.py:0-0
Timestamp: 2025-05-04T10:29:46.780Z
Learning: When a country class in the holidays library uses additional categories beyond PUBLIC, the `supported_categories` tuple should contain all categories, including PUBLIC. Only when PUBLIC is the only category being used should it be omitted from `supported_categories`.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_australia.py
📚 Learning: 2025-08-20T19:46:15.625Z
Learnt from: KJhellico
PR: vacanza/holidays#2833
File: tests/countries/test_uganda.py:15-0
Timestamp: 2025-08-20T19:46:15.625Z
Learning: In the holidays project, the standard import pattern for country test files is `from holidays.countries.<country> import Country, CODE1, CODE2` (direct module import), used by ~75% of country test files. Only a minority (~25%) use the aggregated public API import `from holidays.countries import Country, CODE1, CODE2`. The direct module import pattern should be used for new country test files to follow the established convention.
Applied to files:
tests/countries/test_andorra.py
📚 Learning: 2025-04-08T14:46:10.656Z
Learnt from: KJhellico
PR: vacanza/holidays#2437
File: holidays/countries/bhutan.py:27-30
Timestamp: 2025-04-08T14:46:10.656Z
Learning: For country classes in the holidays library, there's no need to explicitly specify `supported_categories = (PUBLIC,)` when PUBLIC is the only category being used, as it's already the default category inherited from HolidayBase.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_australia.py
📚 Learning: 2025-08-12T17:16:54.497Z
Learnt from: PPsyrius
PR: vacanza/holidays#2794
File: tests/calendars/test_julian.py:35-36
Timestamp: 2025-08-12T17:16:54.497Z
Learning: In the vacanza/holidays project calendar tests (Thai, Ethiopian, Julian, etc.), the established testing pattern for validation methods is to use simple for loops like `for year in known_data_dict:` followed by `self.assertEqual(expected, actual)` without using unittest's subTest feature. This pattern is consistently maintained across all calendar test files.
Applied to files:
tests/countries/test_andorra.py
tests/common.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_austria.py
tests/countries/test_australia.py
📚 Learning: 2025-06-18T10:07:58.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: holidays/countries/french_southern_territories.py:41-44
Timestamp: 2025-06-18T10:07:58.780Z
Learning: Territorial holiday classes that inherit from parent countries (like HolidaysAX from Finland, HolidaysSJ from Norway, HolidaysTF from France) follow a standard pattern of silently overriding self.subdiv in their _populate_public_holidays() method without validation, as this ensures they always use the correct subdivision code for their territory regardless of user input.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_argentina.py
tests/countries/test_australia.py
📚 Learning: 2025-06-14T11:05:21.250Z
Learnt from: PPsyrius
PR: vacanza/holidays#2609
File: holidays/countries/nauru.py:48-50
Timestamp: 2025-06-14T11:05:21.250Z
Learning: In the holidays library, newer implementations use `start_year` to indicate the earliest year with complete holiday data coverage, not necessarily the first year a holiday existed. If a holiday system starts partway through a year (like Nauru's Public Holidays Act starting Jan 31, 1968), the start_year should be set to the following year (1969) to ensure users get full annual holiday coverage.
Applied to files:
holidays/countries/algeria.py
tests/countries/test_armenia.py
tests/countries/test_argentina.py
tests/countries/test_anguilla.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-07-10T15:55:34.523Z
Learnt from: KJhellico
PR: vacanza/holidays#2706
File: holidays/countries/cayman_islands.py:50-55
Timestamp: 2025-07-10T15:55:34.523Z
Learning: The `islamic_show_estimated` parameter in country class constructors is only needed for countries that implement Islamic holidays (inherit from IslamicHolidays or _CustomIslamicHolidays groups). Countries with only Christian and secular holidays do not need this parameter.
Applied to files:
holidays/countries/algeria.py
📚 Learning: 2025-08-22T19:06:04.303Z
Learnt from: KJhellico
PR: vacanza/holidays#2850
File: holidays/countries/christmas_island.py:75-80
Timestamp: 2025-08-22T19:06:04.303Z
Learning: Christmas Island's docstring for the `islamic_show_estimated` parameter follows the exact same format used consistently across all countries with Islamic holidays in the codebase: "Whether to add 'estimated' label to Islamic holidays name if holiday date is estimated." This is the standard, established pattern and should not be changed.
Applied to files:
holidays/countries/algeria.py
tests/countries/test_argentina.py
📚 Learning: 2025-08-21T04:56:03.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/algeria.py
📚 Learning: 2025-06-16T14:08:09.492Z
Learnt from: KJhellico
PR: vacanza/holidays#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/algeria.py
📚 Learning: 2025-08-21T04:56:03.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/algeria.py
📚 Learning: 2025-08-19T21:00:47.849Z
Learnt from: KJhellico
PR: vacanza/holidays#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/algeria.py
📚 Learning: 2025-05-10T04:02:13.815Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/algeria.py
📚 Learning: 2025-05-10T04:32:15.760Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/algeria.py
📚 Learning: 2025-04-03T13:03:16.558Z
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:101-106
Timestamp: 2025-04-03T13:03:16.558Z
Learning: For Islamic holidays in Guinea like "Lendemain de la nuit Lailatoul Qadr" (Day after Night of Power) and "Lendemain de la nuit du Maoloud" (Day after Prophet's Birthday), the naming refers to the daylight hours following the night when these Islamic observances occur. Since in the Islamic calendar days begin at sunset rather than midnight, methods like `_add_laylat_al_qadr_day` and `_add_mawlid_day` correctly calculate these dates without requiring an additional day offset in the implementation, following the same pattern as in the Ivory Coast implementation.
Applied to files:
holidays/countries/algeria.py
📚 Learning: 2025-04-03T13:03:16.558Z
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:101-106
Timestamp: 2025-04-03T13:03:16.558Z
Learning: For Islamic holidays in Guinea like "Lendemain de la nuit Lailatoul Qadr" (Day after Night of Power) and "Lendemain de la nuit du Maoloud" (Day after Prophet's Birthday), the naming refers to the daylight hours following the night when these Islamic observances occur. Since in the Islamic calendar days begin at sunset rather than midnight, methods like `_add_laylat_al_qadr_day` and `_add_mawlid_day` correctly calculate these dates without requiring an additional day offset in the implementation.
Applied to files:
holidays/countries/algeria.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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 covered by the test_eid_al_fitr_day() method, which tests both regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
Applied to files:
holidays/countries/algeria.py
tests/countries/test_azerbaijan.py
tests/countries/test_albania.py
tests/countries/test_algeria.py
tests/countries/test_afghanistan.py
tests/countries/test_angola.py
tests/countries/test_australia.py
📚 Learning: 2025-08-19T20:39:52.024Z
Learnt from: KJhellico
PR: vacanza/holidays#2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T20:39:52.024Z
Learning: In South Sudan holidays implementation, Eid al-Fitr and Eid al-Adha follow a specific two-day pattern: the first day of each Eid is a PUBLIC holiday (national holiday for everyone), while the second day is an ISLAMIC category holiday (Muslim-specific only). This should be implemented by keeping first day calls in _populate_public_holidays() and adding second day calls in _populate_islamic_holidays() method.
Applied to files:
holidays/countries/algeria.py
📚 Learning: 2025-03-30T13:54:34.376Z
Learnt from: KJhellico
PR: vacanza/holidays#2388
File: holidays/countries/ivory_coast.py:98-107
Timestamp: 2025-03-30T13:54:34.376Z
Learning: In the Islamic calendar, days begin at sunset rather than midnight. For holidays like "Lendemain de la Nuit du Destin" (Day after Night of Destiny) in Ivory Coast, the name refers to the daylight hours following the night of Laylat al-Qadr (27th of Ramadan). The implementation uses `_add_laylat_al_qadr_day` which correctly calculates this as the 27th day of Ramadan in the Gregorian calendar.
Applied to files:
holidays/countries/algeria.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_armenia.py
tests/common.py
tests/countries/test_albania.py
tests/countries/test_algeria.py
📚 Learning: 2025-06-13T15:15:25.159Z
Learnt from: KJhellico
PR: vacanza/holidays#2609
File: tests/countries/test_nauru.py:20-24
Timestamp: 2025-06-13T15:15:25.159Z
Learning: In the vacanza/holidays test suite, overriding `setUpClass` is intentionally done with the single `cls` parameter (no *args/**kwargs), so signature-mismatch lint warnings are ignored project-wide.
Applied to files:
tests/common.py
📚 Learning: 2025-04-02T18:38:35.164Z
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
Applied to files:
tests/common.py
tests/countries/test_austria.py
📚 Learning: 2025-05-12T15:31:58.079Z
Learnt from: KJhellico
PR: vacanza/holidays#2532
File: tests/countries/test_cocos_islands.py:78-89
Timestamp: 2025-05-12T15:31:58.079Z
Learning: In the holidays project, tests for movable holidays (like Easter Monday) should always use static date sets only, not calculation functions.
Applied to files:
tests/common.py
📚 Learning: 2025-08-03T13:48:11.910Z
Learnt from: KJhellico
PR: vacanza/holidays#2777
File: holidays/countries/gambia.py:120-122
Timestamp: 2025-08-03T13:48:11.910Z
Learning: When reviewing holiday implementations in the holidays library, defer to the maintainers' choice of start years for specific holiday policies, as they likely have access to more reliable primary sources and official documentation than what can be found through web searches.
Applied to files:
tests/common.py
📚 Learning: 2025-03-29T17:55:09.799Z
Learnt from: ankushhKapoor
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:29-34
Timestamp: 2025-03-29T17:55:09.799Z
Learning: In the holidays library, classes with multiple inheritance from various holiday groups (like ChristianHolidays, HinduCalendarHolidays, etc.) should initialize each parent class separately rather than using `super().__init__(*args, **kwargs)` because the parent classes have different parameter requirements. HolidayBase should receive the `*args, **kwargs` while other holiday group classes typically don't accept parameters like `observed`.
Applied to files:
tests/common.py
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.py
tests/countries/test_albania.py
tests/countries/test_argentina.py
tests/countries/test_afghanistan.py
📚 Learning: 2025-04-23T09:59:19.886Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-06-25T10:39:18.504Z
Learnt from: PPsyrius
PR: vacanza/holidays#2678
File: tests/countries/test_american_samoa.py:83-107
Timestamp: 2025-06-25T10:39:18.504Z
Learning: In the holidays library, test methods (especially localization test methods like test_l10n_th, test_l10n_default) do not require docstrings as this is the standard library-wide approach.
Applied to files:
tests/common.py
📚 Learning: 2025-06-25T10:36:39.909Z
Learnt from: PPsyrius
PR: vacanza/holidays#2678
File: tests/countries/test_united_states_virgin_islands.py:59-84
Timestamp: 2025-06-25T10:36:39.909Z
Learning: In the holidays library, test methods typically do not have docstrings. Only special test methods that need specific explanation (like edge cases or unique behaviors) have docstrings. Regular test methods like test_l10n_default, test_l10n_th, test_government_holidays, etc. should not have docstrings added.
Applied to files:
tests/common.py
📚 Learning: 2025-06-16T15:48:48.680Z
Learnt from: PPsyrius
PR: vacanza/holidays#2615
File: tests/countries/test_anguilla.py:1-12
Timestamp: 2025-06-16T15:48:48.680Z
Learning: Test files in the holidays repository follow a standardized structure without module or class docstrings. All country test files use the same pattern: license header, imports, and class definition (`class Test{Country}(CommonCountryTests, TestCase):`) without docstrings. This is an established codebase convention that should be maintained for consistency.
Applied to files:
tests/common.py
📚 Learning: 2025-06-14T20:46:32.773Z
Learnt from: KJhellico
PR: vacanza/holidays#2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T20:46:32.773Z
Learning: In the vacanza/holidays project tests, inner classes that shadow outer test class names are not standard practice. The test_sint_maarten.py file appears to be the only file using this pattern, making it an outlier rather than following project conventions.
Applied to files:
tests/common.py
📚 Learning: 2025-06-15T15:24:53.055Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-09-01T16:07:42.721Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/common.py:103-108
Timestamp: 2025-09-01T16:07:42.721Z
Learning: In the vacanza/holidays test framework, the set_language method in TestCase is an instance method that only sets os.environ["LANGUAGE"] without using self. It can be called unconventionally from setUpClass as cls.set_language(test_class, default_lang) where test_class serves as a dummy self parameter, but this pattern works because self is unused in the method implementation.
Applied to files:
tests/common.py
📚 Learning: 2025-06-14T20:43:15.370Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-08-30T12:52:58.513Z
Learnt from: KJhellico
PR: vacanza/holidays#2834
File: tests/financial/test_national_stock_exchange_of_india.py:342-360
Timestamp: 2025-08-30T12:52:58.513Z
Learning: In the NSE holidays implementation, assertLocalizedHolidays should only include holidays that are actually observed (trading holidays), not holidays that fall on weekends and are excluded by the observed_rule. For example, Eid al-Fitr 2023 falls on Saturday and is correctly excluded from localization tests.
Applied to files:
tests/common.py
tests/countries/test_azerbaijan.py
📚 Learning: 2025-03-23T16:59:25.794Z
Learnt from: PPsyrius
PR: vacanza/holidays#2362
File: tests/test_ical.py:31-40
Timestamp: 2025-03-23T16:59:25.794Z
Learning: In the holidays library's `TestIcalExporter` class, initializing `ICalExporter` with `None` is intentional. Using a mock object instead breaks tests because the constructor performs attribute validation with `getattr(self.holidays, "language", None)` which returns a mock with a mock object instead of `None`, causing validation failures. The approach isolates file operation tests from iCal generation logic.
Applied to files:
tests/common.py
📚 Learning: 2025-04-13T19:10:31.502Z
Learnt from: KJhellico
PR: vacanza/holidays#2465
File: holidays/countries/suriname.py:219-251
Timestamp: 2025-04-13T19:10:31.502Z
Learning: The `_CustomIslamicHolidays` classes in this project contain only exact verified holiday dates from reliable sources, rather than calculated or estimated future dates. This is by design to ensure accuracy, particularly for religious holidays that may follow lunar calendars or depend on local observations.
Applied to files:
tests/countries/test_azerbaijan.py
tests/countries/test_argentina.py
📚 Learning: 2025-08-24T13:01:51.370Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2852
File: tests/countries/test_tajikistan.py:26-28
Timestamp: 2025-08-24T13:01:51.370Z
Learning: In the holidays project country test files, the standard method name for testing country aliases (ISO codes) is `test_country_aliases`, not `test_aliases`. This naming convention is consistently used across all country test files.
Applied to files:
tests/countries/test_albania.py
tests/countries/test_argentina.py
📚 Learning: 2025-08-24T13:01:51.370Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2852
File: tests/countries/test_tajikistan.py:26-28
Timestamp: 2025-08-24T13:01:51.370Z
Learning: In the holidays project country test files, the universally adopted standard method name for testing country aliases (ISO codes) is `test_country_aliases`. This naming convention is used consistently across all 235+ country test files in the repository, with no exceptions using `test_aliases`.
Applied to files:
tests/countries/test_argentina.py
📚 Learning: 2025-06-18T10:10:46.158Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_france.py:24-27
Timestamp: 2025-06-18T10:10:46.158Z
Learning: The holidays library prioritizes full test coverage over performance in test suites. Modern library-wide standards favor comprehensive testing across all subdivisions and wide year ranges (e.g., 1803-2050 for France) to ensure thorough validation, even if it creates many test objects.
Applied to files:
tests/countries/test_algeria.py
📚 Learning: 2025-08-24T06:53:35.897Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#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:
tests/countries/test_angola.py
📚 Learning: 2025-08-31T09:54:22.072Z
Learnt from: PPsyrius
PR: vacanza/holidays#2874
File: tests/countries/test_taiwan.py:379-381
Timestamp: 2025-08-31T09:54:22.072Z
Learning: In Taiwan's holiday system, some holidays like Women's Day can appear in multiple categories simultaneously. Women's Day appears in the WORKDAY category for regular March 8th dates but also has special observed dates in the OPTIONAL category (1998-2000) when it was moved before Tomb-Sweeping Day. The test cases correctly reflect this dual-category behavior.
Applied to files:
tests/countries/test_angola.py
🧬 Code graph analysis (16)
tests/countries/test_american_samoa.py (1)
holidays/countries/american_samoa.py (2)
HolidaysAS
(17-27)AS
(34-35)
tests/countries/test_antigua_and_barbuda.py (3)
holidays/countries/antigua_and_barbuda.py (3)
AG
(110-111)AntiguaAndBarbuda
(23-107)ATG
(114-115)tests/common.py (2)
setUpClass
(93-184)assertAliases
(252-261)tests/countries/test_afghanistan.py (2)
setUpClass
(21-23)test_no_holidays
(28-29)
tests/countries/test_aruba.py (2)
holidays/countries/aruba.py (3)
AW
(154-155)Aruba
(24-151)ABW
(158-159)tests/common.py (2)
setUpClass
(93-184)assertAliases
(252-261)
tests/countries/test_andorra.py (1)
holidays/countries/andorra.py (3)
Andorra
(20-221)AD
(224-225)AND
(228-229)
holidays/countries/algeria.py (1)
holidays/groups/islamic.py (5)
_add_eid_al_fitr_day_two
(165-173)_add_eid_al_fitr_day_three
(175-183)_add_eid_al_adha_day
(109-120)_add_eid_al_adha_day_two
(122-130)_add_eid_al_adha_day_three
(132-140)
tests/countries/test_armenia.py (3)
holidays/countries/armenia.py (3)
AM
(103-104)Armenia
(20-100)ARM
(107-108)tests/common.py (2)
setUpClass
(93-184)assertAliases
(252-261)tests/countries/test_albania.py (1)
setUpClass
(21-23)
tests/common.py (2)
holidays/holiday_base.py (3)
HolidayBase
(57-1296)get_named
(988-1044)get
(946-969)holidays/observed_holiday_base.py (1)
ObservedHolidayBase
(102-246)
tests/countries/test_azerbaijan.py (2)
holidays/countries/azerbaijan.py (3)
Azerbaijan
(27-197)AZ
(200-201)AZE
(204-205)tests/common.py (3)
WorkingDayTests
(540-559)TestCase
(33-430)setUpClass
(93-184)
tests/countries/test_albania.py (3)
holidays/countries/albania.py (3)
AL
(127-128)Albania
(27-124)ALB
(131-132)tests/common.py (2)
setUpClass
(93-184)assertAliases
(252-261)tests/countries/test_andorra.py (1)
setUpClass
(22-27)
tests/countries/test_argentina.py (2)
holidays/countries/argentina.py (3)
Argentina
(33-773)AR
(776-777)ARG
(780-781)tests/common.py (2)
TestCase
(33-430)setUpClass
(93-184)
tests/countries/test_algeria.py (2)
holidays/countries/algeria.py (3)
DZ
(103-104)Algeria
(20-100)DZA
(107-108)tests/common.py (1)
setUpClass
(93-184)
tests/countries/test_anguilla.py (3)
holidays/countries/anguilla.py (3)
AI
(150-151)Anguilla
(27-147)AIA
(154-155)tests/common.py (2)
setUpClass
(93-184)assertAliases
(252-261)tests/countries/test_afghanistan.py (2)
setUpClass
(21-23)test_no_holidays
(28-29)
tests/countries/test_austria.py (3)
holidays/countries/austria.py (3)
AT
(166-167)Austria
(20-163)AUT
(170-171)tests/common.py (2)
setUpClass
(93-184)assertAliases
(252-261)tests/countries/test_argentina.py (1)
setUpClass
(22-36)
tests/countries/test_afghanistan.py (2)
holidays/countries/afghanistan.py (3)
AF
(114-115)Afghanistan
(21-111)AFG
(118-119)tests/common.py (2)
setUpClass
(93-184)assertAliases
(252-261)
tests/countries/test_angola.py (5)
holidays/countries/angola.py (3)
AO
(175-176)Angola
(27-172)AGO
(179-180)tests/countries/test_albania.py (2)
setUpClass
(21-23)test_no_holidays
(28-29)tests/countries/test_andorra.py (2)
setUpClass
(22-27)test_no_holidays
(32-35)tests/countries/test_argentina.py (2)
setUpClass
(22-36)test_no_holidays
(41-47)tests/countries/test_american_samoa.py (1)
test_no_holidays
(27-28)
tests/countries/test_australia.py (2)
holidays/countries/australia.py (3)
Australia
(30-864)AU
(867-868)AUS
(871-872)tests/common.py (2)
TestCase
(33-430)setUpClass
(93-184)
⏰ 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). (1)
- GitHub Check: Test Python 3.13 on windows-latest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
tests/countries/test_andorra.py
(14 hunks)tests/countries/test_belarus.py
(2 hunks)tests/countries/test_brunei.py
(5 hunks)tests/countries/test_bulgaria.py
(2 hunks)tests/countries/test_norway.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (58)
📓 Common learnings
Learnt from: PPsyrius
PR: vacanza/holidays#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
PR: vacanza/holidays#2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.
Learnt from: KJhellico
PR: vacanza/holidays#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
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/financial/test_ice_futures_europe.py:22-22
Timestamp: 2025-09-02T08:02:03.604Z
Learning: In the vacanza/holidays project, cls.full_range should only be introduced in financial test classes when there are test methods that actually iterate over or use the full year range. For test classes like ICEFuturesEurope that only have year-specific tests (e.g., test_2021, test_2022), using the range directly in setUpClass is preferred to avoid premature abstraction.
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_argentina.py:1080-1082
Timestamp: 2025-09-20T04:11:45.011Z
Learning: In the vacanza/holidays project's TestCase syntactic sugar framework, assertion method names follow the pattern `assert` + `{category}` + `{flag}` + `{method}`. For example, `assertIslamicIslamicNoEstimatedHolidayName` breaks down as: assert + Islamic (category) + IslamicNoEstimated (flag) + HolidayName (method). The apparent "duplication" of "Islamic" is intentional - the first refers to the category, the second is part of the flag name.
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.
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.
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.
Learnt from: PPsyrius
PR: vacanza/holidays#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: 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.
Learnt from: PPsyrius
PR: vacanza/holidays#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.
📚 Learning: 2025-09-10T16:17:30.428Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
📚 Learning: 2025-09-14T06:39:32.896Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_switzerland.py:22-23
Timestamp: 2025-09-14T06:39:32.896Z
Learning: In tests/countries/test_switzerland.py, the cls.full_range = range(1970, 2050) is intentionally hard-coded rather than using CH.start_year until a proper test case refactor is completed for Switzerland's implementation.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_bulgaria.py
📚 Learning: 2025-06-14T10:58:43.636Z
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_andorra.py
📚 Learning: 2025-09-14T16:05:55.205Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
tests/countries/test_norway.py
📚 Learning: 2025-09-14T16:14:44.966Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bulgaria.py:21-23
Timestamp: 2025-09-14T16:14:44.966Z
Learning: For Bulgaria in the holidays library, using years_non_observed=range(2017, 2030) in tests/countries/test_bulgaria.py is intentional because all observed holiday examples in the test data fall within this range (latest being 2029), making this range appropriate for limiting testing to years where observed holidays actually exist, improving both correctness and performance.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
tests/countries/test_norway.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_paraguay.py:134-139
Timestamp: 2025-09-17T09:07:56.459Z
Learning: In the vacanza/holidays project, when testing 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)` for the holiday dates and `assertNoHolidayName(name, range(self.start_year, specific_year))` for the gap period. Using `self.full_range` with year conditions like `if year >= specific_year` is not the established pattern and would be inconsistent with the codebase.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
tests/countries/test_norway.py
📚 Learning: 2025-09-20T12:21:50.877Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
tests/countries/test_norway.py
📚 Learning: 2025-09-14T16:14:44.966Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bulgaria.py:21-23
Timestamp: 2025-09-14T16:14:44.966Z
Learning: For Bulgaria in the holidays library, using years_non_observed=range(2017, 2030) in tests/countries/test_bulgaria.py is intentional because all observed holiday examples in the test data fall within this range (latest being 2029), making this range appropriate for limiting testing to years where observed holidays actually exist.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
tests/countries/test_norway.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
tests/countries/test_brunei.py
📚 Learning: 2025-09-03T14:05:10.592Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_aruba.py:77-79
Timestamp: 2025-09-03T14:05:10.592Z
Learning: The assertNoHolidayName helper method in the vacanza/holidays test framework accepts both individual years (scalars) and iterables of years, making calls like assertNoHolidayName(name, AW.start_year, range(2023, 2050)) valid where AW.start_year is a single integer year.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_norway.py
📚 Learning: 2025-09-28T05:42:12.755Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_indonesia.py:221-223
Timestamp: 2025-09-28T05:42:12.755Z
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/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_norway.py
📚 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_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
tests/countries/test_norway.py
📚 Learning: 2025-09-10T13:46:06.329Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_canada.py:745-747
Timestamp: 2025-09-10T13:46:06.329Z
Learning: In the vacanza/holidays test framework, assertion methods like assertNoSubdivNuOptionalHolidayName correctly accept multiple range objects as separate arguments, such as assertNoSubdivNuOptionalHolidayName(name, range(CA.start_year, 2000), range(2020, 2050)). This is the intended usage pattern and should not be "fixed" by splitting into separate calls.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_andorra.py
📚 Learning: 2025-09-20T04:11:45.011Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_argentina.py:1080-1082
Timestamp: 2025-09-20T04:11:45.011Z
Learning: In the vacanza/holidays project's TestCase syntactic sugar framework, assertion method names follow the pattern `assert` + `{category}` + `{flag}` + `{method}`. For example, `assertIslamicIslamicNoEstimatedHolidayName` breaks down as: assert + Islamic (category) + IslamicNoEstimated (flag) + HolidayName (method). The apparent "duplication" of "Islamic" is intentional - the first refers to the category, the second is part of the flag name.
Applied to files:
tests/countries/test_brunei.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.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_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.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_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
tests/countries/test_norway.py
📚 Learning: 2025-04-05T04:33:53.254Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
Applied to files:
tests/countries/test_brunei.py
📚 Learning: 2025-09-10T21:12:39.614Z
Learnt from: KJhellico
PR: vacanza/holidays#2854
File: tests/countries/test_sudan.py:21-25
Timestamp: 2025-09-10T21:12:39.614Z
Learning: Sudan holidays implementation does not include observed holiday logic (holidays that shift when falling on weekends), so test files for Sudan should not use years_non_observed parameter in the setUpClass method.
Applied to files:
tests/countries/test_brunei.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_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.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_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
tests/countries/test_norway.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_andorra.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_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
tests/countries/test_norway.py
📚 Learning: 2025-09-03T16:49:35.246Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/countries/test_brunei.py
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_brunei.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
PR: vacanza/holidays#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/countries/test_brunei.py
tests/countries/test_norway.py
📚 Learning: 2025-09-14T16:23:46.707Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_botswana.py:59-59
Timestamp: 2025-09-14T16:23:46.707Z
Learning: In Botswana's holiday tests, assertNonObservedHoliday(dt) is used to verify that certain holidays (like Easter holidays) stay on their original dates regardless of the observed holiday system, which is different from assertNoNonObservedHoliday that checks for absence of non-observed holidays.
Applied to files:
tests/countries/test_brunei.py
tests/countries/test_bulgaria.py
📚 Learning: 2025-09-14T16:23:46.707Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_botswana.py:59-59
Timestamp: 2025-09-14T16:23:46.707Z
Learning: The method assertNonObservedHoliday(dt) is a valid assertion method in the holidays test framework that verifies holidays occur on their original (non-observed) dates, which is different from assertNoNonObservedHoliday that checks for absence of non-observed holidays. It's used to test that certain holidays stay on fixed dates regardless of observed holiday rules.
Applied to files:
tests/countries/test_brunei.py
📚 Learning: 2025-09-03T18:29:09.398Z
Learnt from: KJhellico
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_brunei.py
📚 Learning: 2025-09-14T04:44:28.854Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_indonesia.py:22-22
Timestamp: 2025-09-14T04:44:28.854Z
Learning: In Indonesia's holidays implementation, observed holidays are only available in years 2004 and 2020 due to presidential decrees, so years_non_observed=(2004, 2020) should be passed as a tuple of discrete years rather than a range.
Applied to files:
tests/countries/test_brunei.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
📚 Learning: 2025-08-28T02:42:52.755Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_belarus.py
📚 Learning: 2025-09-14T16:19:23.651Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_antigua_and_barbuda.py:27-29
Timestamp: 2025-09-14T16:19:23.651Z
Learning: For Antigua and Barbuda in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=AntiguaAndBarbuda.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and AntiguaAndBarbuda doesn't define supported_categories.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_bulgaria.py
📚 Learning: 2025-09-04T09:48:11.738Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_andorra.py:29-31
Timestamp: 2025-09-04T09:48:11.738Z
Learning: In the holidays library, when accessing supported_categories in test files, the library-wide standard is to use the full class name (e.g., Andorra.supported_categories) rather than aliases (e.g., AD.supported_categories), maintaining consistency across the codebase.
Applied to files:
tests/countries/test_andorra.py
📚 Learning: 2025-09-19T10:01:41.205Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bolivia.py:29-29
Timestamp: 2025-09-19T10:01:41.205Z
Learning: For Bolivia in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bolivia.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and Bolivia doesn't define supported_categories.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_belarus.py
📚 Learning: 2025-09-04T09:48:11.738Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_andorra.py:29-31
Timestamp: 2025-09-04T09:48:11.738Z
Learning: In the holidays library, when accessing supported_categories in test files, the library-wide standard is to use the full class name (e.g., Andorra.supported_categories) rather than aliases (e.g., AD.supported_categories), with a 12:1 ratio favoring the full class name pattern across the codebase.
Applied to files:
tests/countries/test_andorra.py
📚 Learning: 2025-06-16T15:48:48.680Z
Learnt from: PPsyrius
PR: vacanza/holidays#2615
File: tests/countries/test_anguilla.py:1-12
Timestamp: 2025-06-16T15:48:48.680Z
Learning: Test files in the holidays repository follow a standardized structure without module or class docstrings. All country test files use the same pattern: license header, imports, and class definition (`class Test{Country}(CommonCountryTests, TestCase):`) without docstrings. This is an established codebase convention that should be maintained for consistency.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_belarus.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_belarus.py
📚 Learning: 2025-09-10T13:39:34.625Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_angola.py:22-22
Timestamp: 2025-09-10T13:39:34.625Z
Learning: In the holidays project, the main testing range should always span from start_year to 2050 (or end_year if available). This applies to both the main years parameter and years_non_observed parameter in test setups to maintain consistency across all country tests.
Applied to files:
tests/countries/test_andorra.py
tests/countries/test_bulgaria.py
📚 Learning: 2025-09-14T16:02:49.378Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bahrain.py:27-29
Timestamp: 2025-09-14T16:02:49.378Z
Learning: For Bahrain in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahrain.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and Bahrain doesn't even define supported_categories.
Applied to files:
tests/countries/test_belarus.py
📚 Learning: 2025-09-14T05:43:22.932Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_belize.py:28-28
Timestamp: 2025-09-14T05:43:22.932Z
Learning: For Belize in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Belize.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Applied to files:
tests/countries/test_belarus.py
📚 Learning: 2025-09-14T16:02:49.378Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bahrain.py:27-29
Timestamp: 2025-09-14T16:02:49.378Z
Learning: For Bahrain in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahrain.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Applied to files:
tests/countries/test_belarus.py
📚 Learning: 2025-04-03T12:36:41.201Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_belarus.py
📚 Learning: 2025-09-14T04:41:10.139Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_south_africa.py:22-22
Timestamp: 2025-09-14T04:41:10.139Z
Learning: South Africa's observed holiday system only started in 1995, so in tests/countries/test_south_africa.py, using years_non_observed=range(1995, 2050) is intentional to limit testing to years where observed holidays actually exist, improving both correctness and performance.
Applied to files:
tests/countries/test_belarus.py
tests/countries/test_bulgaria.py
tests/countries/test_norway.py
📚 Learning: 2025-08-08T14:35:35.829Z
Learnt from: KJhellico
PR: vacanza/holidays#2774
File: tests/countries/test_liberia.py:33-46
Timestamp: 2025-08-08T14:35:35.829Z
Learning: In tests/countries/test_liberia.py, prefer neutral comments that reference the election-year rule for Inauguration Day (first Monday of January after an election year). Avoid naming specific winners; e.g., note “1976 follows the 1975 election,” not candidate details.
Applied to files:
tests/countries/test_belarus.py
📚 Learning: 2025-05-10T04:32:15.760Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_belarus.py
📚 Learning: 2025-07-14T20:23:48.198Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/countries/test_belarus.py
📚 Learning: 2025-08-25T09:57:22.291Z
Learnt from: PPsyrius
PR: vacanza/holidays#2833
File: holidays/countries/uganda.py:50-56
Timestamp: 2025-08-25T09:57:22.291Z
Learning: In the holidays package, when adding comments for year-restricted holidays in Uganda and similar country modules, include specific legal or historical context such as the actual laws, parliamentary acts, or government decisions that established the holidays, rather than just generic "since YEAR" information. For example, reference the specific Parliament act, decree, or historical event that created the holiday.
Applied to files:
tests/countries/test_belarus.py
📚 Learning: 2025-04-23T09:22:41.753Z
Learnt from: PPsyrius
PR: vacanza/holidays#2489
File: holidays/countries/sao_tome_and_principe.py:86-88
Timestamp: 2025-04-23T09:22:41.753Z
Learning: For holiday definitions in the holidays package, keep comments simple with just the holiday name (e.g., "# Independence Day.") rather than including dates or historical context, as the function names already encode the date information.
Applied to files:
tests/countries/test_belarus.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_belarus.py
📚 Learning: 2025-08-03T13:48:11.910Z
Learnt from: KJhellico
PR: vacanza/holidays#2777
File: holidays/countries/gambia.py:120-122
Timestamp: 2025-08-03T13:48:11.910Z
Learning: When reviewing holiday implementations in the holidays library, defer to the maintainers' choice of start years for specific holiday policies, as they likely have access to more reliable primary sources and official documentation than what can be found through web searches.
Applied to files:
tests/countries/test_belarus.py
📚 Learning: 2025-09-02T08:02:03.604Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/financial/test_ice_futures_europe.py:22-22
Timestamp: 2025-09-02T08:02:03.604Z
Learning: In the vacanza/holidays project, cls.full_range should only be introduced in financial test classes when there are test methods that actually iterate over or use the full year range. For test classes like ICEFuturesEurope that only have year-specific tests (e.g., test_2021, test_2022), using the range directly in setUpClass is preferred to avoid premature abstraction.
Applied to files:
tests/countries/test_bulgaria.py
📚 Learning: 2025-05-09T18:36:09.607Z
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Applied to files:
tests/countries/test_bulgaria.py
📚 Learning: 2025-09-25T08:56:22.444Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_azerbaijan.py:23-24
Timestamp: 2025-09-25T08:56:22.444Z
Learning: In the vacanza/holidays project's test framework, TestCase.setUpClass is designed to handle pre-existing cls.full_range attributes. If a test class manually sets cls.full_range before calling super().setUpClass(), the framework will use cls.full_range.start and cls.full_range.stop to set start_year and end_year, then use cls.full_range as the years parameter. This allows test classes to define custom year ranges when needed while still integrating with the framework.
Applied to files:
tests/countries/test_bulgaria.py
🧬 Code graph analysis (5)
tests/countries/test_brunei.py (2)
tests/countries/test_andorra.py (5)
setUpClass
(22-23)test_country_aliases
(25-26)test_no_holidays
(28-31)test_new_years_day
(33-34)test_christmas_day
(115-116)holidays/countries/brunei.py (2)
Brunei
(49-257)BN
(260-261)
tests/countries/test_andorra.py (1)
holidays/countries/andorra.py (1)
Andorra
(20-221)
tests/countries/test_belarus.py (3)
tests/countries/test_andorra.py (4)
setUpClass
(22-23)test_country_aliases
(25-26)test_no_holidays
(28-31)test_new_years_day
(33-34)tests/common.py (2)
setUpClass
(106-260)assertAliases
(323-332)holidays/countries/belarus.py (3)
Belarus
(22-136)BY
(139-140)BLR
(143-144)
tests/countries/test_bulgaria.py (3)
tests/countries/test_andorra.py (2)
setUpClass
(22-23)test_no_holidays
(28-31)tests/common.py (1)
setUpClass
(106-260)holidays/countries/bulgaria.py (2)
Bulgaria
(27-135)BG
(138-139)
tests/countries/test_norway.py (1)
holidays/countries/norway.py (1)
Norway
(20-145)
🔇 Additional comments (2)
tests/countries/test_norway.py (1)
111-111
: Year-scoped assert wiring looks good.Passing the Norway instance constrained to 2022 makes the check crisp for that year and matches the new syntactic-sugar flow. All clear here.
tests/countries/test_belarus.py (1)
28-30
: Nice coverage for all categories.Using
Belarus.supported_categories
here keepstest_no_holidays
in sync with the shared harness so both PUBLIC and WORKDAY paths are exercised together—exactly what we want. Based on learnings
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. It's a great work! 🚀 Although the total test execution time increases, I think that when all tests are reworked to the new standard, we will be able to optimize this by removing the initialization of objects with redundant parameter combinations.
|
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)
tests/common.py (2)
384-392
: Avoid parse() side effects; treat strings as date-like.Boolean use of dateutil.parse can raise unexpectedly. Simpler and safer to accept str/date directly.
- elif isinstance(arg, date) or parse(arg): # Exact date check. + elif isinstance(arg, (date, str)): # Exact date check. for dt in items: self.assertIn(name, holidays.get_list(dt), dt) else: raise ValueError(f"The {arg} wasn't caught by `assertHolidayName()`")
455-463
: Mirror the parse() simplification in the negated variant.Keep behavior consistent and avoid parse() raising ValueError in control flow.
- elif isinstance(arg, date) or parse(arg): # Exact date check. + elif isinstance(arg, (date, str)): # Exact date check. for dt in items: self.assertNotIn(name, holidays.get_list(dt), dt) else: raise ValueError(f"The {arg} wasn't caught by `assertNoHolidayName()`")
♻️ Duplicate comments (1)
tests/countries/test_chile.py (1)
43-53
: Tighten Jan 2 negatives (non‑Monday years).Add explicit no‑holiday checks for recent non‑Monday Jan 2 dates to guard regressions. Mirrors prior suggestion.
[suggest_minor_issue]
Apply:self.assertNoHolidayName( name_jan_2, (f"{year}-01-02" for year in range(self.start_year, 2017)) ) + # Jan 2 should only be a holiday when it falls on Monday (since 2017). + self.assertNoHolidayName( + name_jan_2, + "2018-01-02", + "2019-01-02", + "2020-01-02", + "2021-01-02", + "2022-01-02", + "2024-01-02", + "2025-01-02", + )
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
tests/common.py
(10 hunks)tests/countries/test_australia.py
(7 hunks)tests/countries/test_bhutan.py
(12 hunks)tests/countries/test_brazil.py
(5 hunks)tests/countries/test_canada.py
(24 hunks)tests/countries/test_chile.py
(9 hunks)
🧰 Additional context used
🧠 Learnings (70)
📓 Common learnings
Learnt from: PPsyrius
PR: vacanza/holidays#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: 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.
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.
📚 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/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-09-20T12:21:50.877Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
📚 Learning: 2025-07-09T21:16:35.145Z
Learnt from: KJhellico
PR: vacanza/holidays#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/common.py
tests/countries/test_australia.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-09-28T05:42:12.777Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
tests/countries/test_chile.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/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
tests/countries/test_chile.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/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_canada.py
📚 Learning: 2025-07-24T15:21:31.632Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_chile.py
📚 Learning: 2025-09-10T21:12:39.614Z
Learnt from: KJhellico
PR: vacanza/holidays#2854
File: tests/countries/test_sudan.py:21-25
Timestamp: 2025-09-10T21:12:39.614Z
Learning: Sudan holidays implementation does not include observed holiday logic (holidays that shift when falling on weekends), so test files for Sudan should not use years_non_observed parameter in the setUpClass method.
Applied to files:
tests/common.py
📚 Learning: 2025-09-04T08:55:09.796Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_angola.py:169-169
Timestamp: 2025-09-04T08:55:09.796Z
Learning: In the vacanza/holidays test framework, internal assertion methods prefixed with underscore (like _assertHolidayDates, _assertHolidayName) are implementation details and should not be called directly in test code. Tests should use the public assertion methods like assertHolidayName, assertGovernmentHolidayName, etc.
Applied to files:
tests/common.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` or `super().setUpClass(HolidayClass, years=...)` where HolidayClass is passed as the first argument. This is the correct signature that matches the CommonCountryTests.setUpClass method which accepts test_class as the first parameter after cls. Pylint warnings about parameter count mismatch are false positives when comparing against TestCase.setUpClass instead of the immediate parent CommonCountryTests.setUpClass.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
tests/common.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py:209-209
Timestamp: 2025-09-14T17:17:14.387Z
Learning: In tests/countries/test_saint_helena_ascension_and_tristan_da_cunha.py, the explicit loop iteration pattern for subdivision-specific holiday checks (like Anniversary Day for TA subdivision) is intentionally preferred over using assertSubdivTa helper methods, as confirmed by PPsyrius.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_canada.py
tests/countries/test_chile.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/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.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/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-04-02T18:38:35.164Z
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: tests/countries/test_guinea.py:237-239
Timestamp: 2025-04-02T18:38:35.164Z
Learning: In the vacanza/holidays project, the method assertLocalizedHolidays in country test files should be called with positional parameters rather than named parameters to maintain consistency with the rest of the codebase.
Applied to files:
tests/common.py
tests/countries/test_chile.py
📚 Learning: 2025-06-16T15:48:48.680Z
Learnt from: PPsyrius
PR: vacanza/holidays#2615
File: tests/countries/test_anguilla.py:1-12
Timestamp: 2025-06-16T15:48:48.680Z
Learning: Test files in the holidays repository follow a standardized structure without module or class docstrings. All country test files use the same pattern: license header, imports, and class definition (`class Test{Country}(CommonCountryTests, TestCase):`) without docstrings. This is an established codebase convention that should be maintained for consistency.
Applied to files:
tests/common.py
📚 Learning: 2025-09-28T05:33:26.259Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_australia.py:185-186
Timestamp: 2025-09-28T05:33:26.259Z
Learning: In the vacanza/holidays project test files, PPsyrius prefers simpler, broader range assertions over historically precise ones. The team doesn't typically add fine-grained historical context or overly specific assertions that don't add meaningful test value, even when they might be more historically accurate.
Applied to files:
tests/common.py
📚 Learning: 2025-09-01T16:07:42.782Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/common.py:103-108
Timestamp: 2025-09-01T16:07:42.782Z
Learning: In the vacanza/holidays test framework, the set_language method in TestCase is an instance method that only sets os.environ["LANGUAGE"] without using self. It can be called unconventionally from setUpClass as cls.set_language(test_class, default_lang) where test_class serves as a dummy self parameter, but this pattern works because self is unused in the method implementation.
Applied to files:
tests/common.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_wallis_and_futuna.py:19-23
Timestamp: 2025-06-18T17:01:58.067Z
Learning: In the vacanza/holidays repository, the standard pattern for test class setUpClass methods is `super().setUpClass(HolidayClass)` where HolidayClass is passed as the first argument. This is the correct signature used across all country test files.
Applied to files:
tests/common.py
tests/countries/test_chile.py
📚 Learning: 2025-06-13T15:15:25.159Z
Learnt from: KJhellico
PR: vacanza/holidays#2609
File: tests/countries/test_nauru.py:20-24
Timestamp: 2025-06-13T15:15:25.159Z
Learning: In the vacanza/holidays test suite, overriding `setUpClass` is intentionally done with the single `cls` parameter (no *args/**kwargs), so signature-mismatch lint warnings are ignored project-wide.
Applied to files:
tests/common.py
📚 Learning: 2025-09-02T08:02:03.604Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/financial/test_ice_futures_europe.py:22-22
Timestamp: 2025-09-02T08:02:03.604Z
Learning: In the vacanza/holidays project, cls.full_range should only be introduced in financial test classes when there are test methods that actually iterate over or use the full year range. For test classes like ICEFuturesEurope that only have year-specific tests (e.g., test_2021, test_2022), using the range directly in setUpClass is preferred to avoid premature abstraction.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
📚 Learning: 2025-08-26T21:29:47.753Z
Learnt from: KJhellico
PR: vacanza/holidays#2860
File: tests/common.py:365-372
Timestamp: 2025-08-26T21:29:47.753Z
Learning: In the holidays library, countries with Islamic holidays inherit directly from the IslamicHolidays class (e.g., `class Afghanistan(HolidayBase, InternationalHolidays, IslamicHolidays)`). The separate `_CustomIslamicHolidays` classes (like `AfghanistanIslamicHolidays`) are helper classes for specific date data, not the main country classes. Therefore, `isinstance(holidays_instance, IslamicHolidays)` is sufficient to detect all countries with Islamic holidays.
Applied to files:
tests/common.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-05-04T10:29:46.780Z
Learnt from: KJhellico
PR: vacanza/holidays#2525
File: holidays/countries/togo.py:0-0
Timestamp: 2025-05-04T10:29:46.780Z
Learning: When a country class in the holidays library uses additional categories beyond PUBLIC, the `supported_categories` tuple should contain all categories, including PUBLIC. Only when PUBLIC is the only category being used should it be omitted from `supported_categories`.
Applied to files:
tests/common.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
PR: vacanza/holidays#2854
File: tests/countries/test_sudan.py:29-31
Timestamp: 2025-09-12T21:37:10.710Z
Learning: For countries in the holidays library that only use the default PUBLIC category (like Sudan), there's no need to specify `categories=Sudan.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-04-08T14:46:10.656Z
Learnt from: KJhellico
PR: vacanza/holidays#2437
File: holidays/countries/bhutan.py:27-30
Timestamp: 2025-04-08T14:46:10.656Z
Learning: For country classes in the holidays library, there's no need to explicitly specify `supported_categories = (PUBLIC,)` when PUBLIC is the only category being used, as it's already the default category inherited from HolidayBase.
Applied to files:
tests/common.py
tests/countries/test_canada.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_curacao.py:29-29
Timestamp: 2025-09-20T12:24:28.864Z
Learning: For Curacao in the holidays library, PUBLIC and HALF_DAY categories have different start years - PUBLIC holidays begin at the country's start_year while HALF_DAY holidays begin in 2010. When testing no_holidays methods, each category should be tested separately with appropriate pre-start years rather than using a unified supported_categories approach.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-09-04T09:48:11.738Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_andorra.py:29-31
Timestamp: 2025-09-04T09:48:11.738Z
Learning: In the holidays library, when accessing supported_categories in test files, the library-wide standard is to use the full class name (e.g., Andorra.supported_categories) rather than aliases (e.g., AD.supported_categories), with a 12:1 ratio favoring the full class name pattern across the codebase.
Applied to files:
tests/common.py
📚 Learning: 2025-09-14T16:12:41.385Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_central_african_republic.py:27-29
Timestamp: 2025-09-14T16:12:41.385Z
Learning: For Central African Republic in the holidays library, only the default PUBLIC category is used, so there's no need to specify categories=CentralAfricanRepublic.supported_categories in test_no_holidays methods, as it would be equivalent to the default behavior and CentralAfricanRepublic doesn't define supported_categories.
Applied to files:
tests/common.py
📚 Learning: 2025-08-28T02:42:52.755Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-06-18T10:07:58.780Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: holidays/countries/french_southern_territories.py:41-44
Timestamp: 2025-06-18T10:07:58.780Z
Learning: Territorial holiday classes that inherit from parent countries (like HolidaysAX from Finland, HolidaysSJ from Norway, HolidaysTF from France) follow a standard pattern of silently overriding self.subdiv in their _populate_public_holidays() method without validation, as this ensures they always use the correct subdivision code for their territory regardless of user input.
Applied to files:
tests/common.py
📚 Learning: 2025-04-23T14:55:35.504Z
Learnt from: PPsyrius
PR: vacanza/holidays#2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.
Applied to files:
tests/common.py
📚 Learning: 2025-09-03T14:05:10.592Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_aruba.py:77-79
Timestamp: 2025-09-03T14:05:10.592Z
Learning: The assertNoHolidayName helper method in the vacanza/holidays test framework accepts both individual years (scalars) and iterables of years, making calls like assertNoHolidayName(name, AW.start_year, range(2023, 2050)) valid where AW.start_year is a single integer year.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_paraguay.py:134-139
Timestamp: 2025-09-17T09:07:56.459Z
Learning: In the vacanza/holidays project, when testing 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)` for the holiday dates and `assertNoHolidayName(name, range(self.start_year, specific_year))` for the gap period. Using `self.full_range` with year conditions like `if year >= specific_year` is not the established pattern and would be inconsistent with the codebase.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-08-12T17:16:54.497Z
Learnt from: PPsyrius
PR: vacanza/holidays#2794
File: tests/calendars/test_julian.py:35-36
Timestamp: 2025-08-12T17:16:54.497Z
Learning: In the vacanza/holidays project calendar tests (Thai, Ethiopian, Julian, etc.), the established testing pattern for validation methods is to use simple for loops like `for year in known_data_dict:` followed by `self.assertEqual(expected, actual)` without using unittest's subTest feature. This pattern is consistently maintained across all calendar test files.
Applied to files:
tests/common.py
tests/countries/test_australia.py
📚 Learning: 2025-09-10T13:46:06.329Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_canada.py:745-747
Timestamp: 2025-09-10T13:46:06.329Z
Learning: In the vacanza/holidays test framework, assertion methods like assertNoSubdivNuOptionalHolidayName correctly accept multiple range objects as separate arguments, such as assertNoSubdivNuOptionalHolidayName(name, range(CA.start_year, 2000), range(2020, 2050)). This is the intended usage pattern and should not be "fixed" by splitting into separate calls.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
📚 Learning: 2025-08-26T14:43:53.605Z
Learnt from: KJhellico
PR: vacanza/holidays#2851
File: docs/holiday_categories.md:272-282
Timestamp: 2025-08-26T14:43:53.605Z
Learning: In the holidays library documentation, it's strongly advisable to recommend the use of constants from holidays.constants (e.g., PUBLIC, CATHOLIC) instead of direct string values when specifying holiday categories, as constants provide better type safety, IDE support, and prevent typos.
Applied to files:
tests/common.py
📚 Learning: 2025-09-03T18:17:24.626Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: holidays/countries/algeria.py:46-49
Timestamp: 2025-09-03T18:17:24.626Z
Learning: In the holidays library, supported_categories tuples are ordered alphabetically rather than having PUBLIC listed first. For example, in Algeria's implementation, (CHRISTIAN, HEBREW, PUBLIC) follows alphabetical order and should not be reordered to put PUBLIC first.
Applied to files:
tests/common.py
📚 Learning: 2025-03-04T11:32:45.095Z
Learnt from: PPsyrius
PR: vacanza/holidays#2323
File: holidays/countries/macau.py:407-461
Timestamp: 2025-03-04T11:32:45.095Z
Learning: In the holidays library, the standard approach for organizing static holidays is to use separate dictionaries for different categories (`government`, `mandatory`, and `public`), which are utilized by syntactic sugar methods.
Applied to files:
tests/common.py
📚 Learning: 2025-03-04T11:32:45.095Z
Learnt from: PPsyrius
PR: vacanza/holidays#2323
File: holidays/countries/macau.py:407-461
Timestamp: 2025-03-04T11:32:45.095Z
Learning: In the holidays library, the standard approach for organizing static holidays is to use separate dictionaries for different categories (like `special_government_holidays`, `special_mandatory_holidays`, and `special_public_holidays`), which are utilized by syntactic sugar methods to pick up the appropriate holidays based on the selected category.
Applied to files:
tests/common.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-09-04T09:48:11.738Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_andorra.py:29-31
Timestamp: 2025-09-04T09:48:11.738Z
Learning: In the holidays library, when accessing supported_categories in test files, the library-wide standard is to use the full class name (e.g., Andorra.supported_categories) rather than aliases (e.g., AD.supported_categories), maintaining consistency across the codebase.
Applied to files:
tests/common.py
📚 Learning: 2025-09-23T13:59:21.063Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/common.py:19-19
Timestamp: 2025-09-23T13:59:21.063Z
Learning: The vacanza/holidays project has a minimum Python version requirement of 3.9+ (specified in pyproject.toml as "requires-python = ">=3.9"") and the CI matrix tests Python versions 3.9 through 3.14. No Python 3.8 support exists, so functools.cache (introduced in Python 3.9) can be used directly without compatibility fallbacks.
Applied to files:
tests/common.py
📚 Learning: 2025-06-15T15:24:53.055Z
Learnt from: KJhellico
PR: vacanza/holidays#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:
tests/common.py
📚 Learning: 2025-09-14T16:17:26.156Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_botswana.py:22-22
Timestamp: 2025-09-14T16:17:26.156Z
Learning: For Botswana in the holidays library, only the default PUBLIC category is used, so there's no need to specify categories=Botswana.supported_categories in test_no_holidays methods, as it would be equivalent to the default behavior and Botswana doesn't define supported_categories.
Applied to files:
tests/common.py
tests/countries/test_brazil.py
📚 Learning: 2025-09-19T10:01:41.205Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bolivia.py:29-29
Timestamp: 2025-09-19T10:01:41.205Z
Learning: For Bolivia in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bolivia.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and Bolivia doesn't define supported_categories.
Applied to files:
tests/common.py
tests/countries/test_brazil.py
tests/countries/test_chile.py
📚 Learning: 2025-09-14T16:09:32.910Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_gabon.py:27-29
Timestamp: 2025-09-14T16:09:32.910Z
Learning: For Gabon in the holidays library, only the default PUBLIC category is used, so there's no need to specify categories=Gabon.supported_categories in test_no_holidays methods, as it would be equivalent to the default behavior and Gabon doesn't define supported_categories.
Applied to files:
tests/common.py
tests/countries/test_brazil.py
📚 Learning: 2025-09-14T16:09:32.910Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_gabon.py:27-29
Timestamp: 2025-09-14T16:09:32.910Z
Learning: For Gabon in the holidays library, only the default PUBLIC category is used, so there's no need to specify categories=Gabon.supported_categories in test_no_holidays methods, as it would be equivalent to the default behavior.
Applied to files:
tests/common.py
tests/countries/test_brazil.py
📚 Learning: 2025-09-14T16:19:23.651Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_antigua_and_barbuda.py:27-29
Timestamp: 2025-09-14T16:19:23.651Z
Learning: For Antigua and Barbuda in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=AntiguaAndBarbuda.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and AntiguaAndBarbuda doesn't define supported_categories.
Applied to files:
tests/common.py
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-09-14T16:02:15.480Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bahamas.py:27-29
Timestamp: 2025-09-14T16:02:15.480Z
Learning: For Bahamas in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahamas.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior.
Applied to files:
tests/common.py
tests/countries/test_brazil.py
tests/countries/test_canada.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/common.py
tests/countries/test_australia.py
tests/countries/test_bhutan.py
tests/countries/test_chile.py
📚 Learning: 2025-09-25T08:56:22.473Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_azerbaijan.py:23-24
Timestamp: 2025-09-25T08:56:22.473Z
Learning: In the vacanza/holidays project's test framework, TestCase.setUpClass is designed to handle pre-existing cls.full_range attributes. If a test class manually sets cls.full_range before calling super().setUpClass(), the framework will use cls.full_range.start and cls.full_range.stop to set start_year and end_year, then use cls.full_range as the years parameter. This allows test classes to define custom year ranges when needed while still integrating with the framework.
Applied to files:
tests/common.py
tests/countries/test_bhutan.py
📚 Learning: 2025-09-03T18:29:09.398Z
Learnt from: KJhellico
PR: vacanza/holidays#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.
Applied to files:
tests/common.py
tests/countries/test_canada.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-09-03T16:49:35.246Z
Learnt from: PPsyrius
PR: vacanza/holidays#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/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-09-14T16:05:55.205Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
PR: vacanza/holidays#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:
tests/countries/test_australia.py
tests/countries/test_brazil.py
📚 Learning: 2025-09-14T04:41:10.139Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_south_africa.py:22-22
Timestamp: 2025-09-14T04:41:10.139Z
Learning: South Africa's observed holiday system only started in 1995, so in tests/countries/test_south_africa.py, using years_non_observed=range(1995, 2050) is intentional to limit testing to years where observed holidays actually exist, improving both correctness and performance.
Applied to files:
tests/countries/test_australia.py
tests/countries/test_brazil.py
tests/countries/test_canada.py
📚 Learning: 2025-09-10T16:17:30.428Z
Learnt from: PPsyrius
PR: vacanza/holidays#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.
Applied to files:
tests/countries/test_brazil.py
tests/countries/test_bhutan.py
tests/countries/test_canada.py
tests/countries/test_chile.py
📚 Learning: 2025-09-29T08:09:54.436Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_brunei.py:27-29
Timestamp: 2025-09-29T08:09:54.436Z
Learning: For Brunei in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Brunei.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and Brunei doesn't define supported_categories.
Applied to files:
tests/countries/test_brazil.py
📚 Learning: 2025-09-14T16:02:49.378Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bahrain.py:27-29
Timestamp: 2025-09-14T16:02:49.378Z
Learning: For Bahrain in the holidays library, only the default PUBLIC category is used, so there's no need to specify `categories=Bahrain.supported_categories` in test_no_holidays methods, as it would be equivalent to the default behavior and Bahrain doesn't even define supported_categories.
Applied to files:
tests/countries/test_brazil.py
📚 Learning: 2025-05-09T18:36:09.607Z
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Applied to files:
tests/countries/test_brazil.py
📚 Learning: 2025-09-14T16:23:46.707Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_botswana.py:59-59
Timestamp: 2025-09-14T16:23:46.707Z
Learning: In Botswana's holiday tests, assertNonObservedHoliday(dt) is used to verify that certain holidays (like Easter holidays) stay on their original dates regardless of the observed holiday system, which is different from assertNoNonObservedHoliday that checks for absence of non-observed holidays.
Applied to files:
tests/countries/test_brazil.py
tests/countries/test_canada.py
📚 Learning: 2025-04-05T04:33:53.254Z
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:33:53.254Z
Learning: For Turkmenistan holiday tests, recommend using CommonCountryTests as the base class rather than unittest.TestCase to follow project conventions, be consistent with other country test files, and gain access to common test utilities.
Applied to files:
tests/countries/test_bhutan.py
📚 Learning: 2025-06-14T10:58:43.636Z
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.
Applied to files:
tests/countries/test_canada.py
📚 Learning: 2025-09-10T13:39:34.625Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_angola.py:22-22
Timestamp: 2025-09-10T13:39:34.625Z
Learning: In the holidays project, the main testing range should always span from start_year to 2050 (or end_year if available). This applies to both the main years parameter and years_non_observed parameter in test setups to maintain consistency across all country tests.
Applied to files:
tests/countries/test_canada.py
📚 Learning: 2025-07-02T18:21:59.302Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:21:59.302Z
Learning: In the Saint Vincent and the Grenadines holiday tests, for holidays without observed rules that only require a single assertHolidayName call, pass the holiday name directly as a string literal rather than storing it in a variable first for cleaner, more concise code.
Applied to files:
tests/countries/test_chile.py
📚 Learning: 2025-07-02T18:17:53.342Z
Learnt from: KJhellico
PR: vacanza/holidays#2608
File: tests/countries/test_saint_vincent_and_the_grenadines.py:162-178
Timestamp: 2025-07-02T18:17:53.342Z
Learning: In the Saint Vincent and the Grenadines holidays implementation, New Year's Day is added without observed rules using `_add_new_years_day()` and should not include observed rule testing in its test method. Only holidays explicitly wrapped with `_add_observed()` have observed behavior.
Applied to files:
tests/countries/test_chile.py
🧬 Code graph analysis (6)
tests/common.py (5)
holidays/holiday_base.py (3)
HolidayBase
(57-1304)get
(956-979)get_named
(998-1054)holidays/groups/eastern.py (1)
EasternCalendarHolidays
(20-73)holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)tests/countries/test_australia.py (1)
setUpClass
(23-24)holidays/observed_holiday_base.py (1)
ObservedHolidayBase
(102-256)
tests/countries/test_australia.py (1)
tests/common.py (1)
setUpClass
(108-273)
tests/countries/test_brazil.py (2)
tests/common.py (1)
setUpClass
(108-273)holidays/countries/brazil.py (3)
Brazil
(22-383)BR
(386-387)BRA
(390-391)
tests/countries/test_bhutan.py (2)
tests/common.py (1)
setUpClass
(108-273)holidays/countries/bhutan.py (3)
Bhutan
(19-164)BT
(167-168)BTN
(171-172)
tests/countries/test_canada.py (2)
holidays/countries/canada.py (2)
Canada
(29-550)CA
(553-554)tests/common.py (2)
CommonCountryTests
(571-576)setUpClass
(108-273)
tests/countries/test_chile.py (2)
tests/common.py (1)
setUpClass
(108-273)holidays/countries/chile.py (1)
Chile
(29-257)
🪛 Ruff (0.13.3)
tests/common.py
38-38: Missing return type annotation for staticmethod _get_or_create_lookup
(ANN205)
38-38: Boolean default positional argument in function definition
(FBT002)
58-58: Missing return type annotation for classmethod _generate_assert_methods
Add return type annotation: None
(ANN206)
61-61: Missing return type annotation for private function make_assert
(ANN202)
62-62: Missing return type annotation for private function _method
(ANN202)
62-62: Missing type annotation for *args
(ANN002)
62-62: Missing type annotation for **kwargs
(ANN003)
108-108: Missing return type annotation for classmethod setUpClass
Add return type annotation: None
(ANN206)
109-109: Boolean default positional argument in function definition
(FBT002)
109-109: Missing type annotation for **year_variants
(ANN003)
122-122: Avoid specifying long messages outside the exception class
(TRY003)
296-296: Use a regular assert
instead of unittest-style assertIsInstance
Replace assertIsInstance(...)
with assert ...
(PT009)
321-321: Use a regular assert
instead of unittest-style assertFalse
Replace assertFalse(...)
with assert ...
(PT009)
323-323: Use a regular assert
instead of unittest-style assertTrue
Replace assertTrue(...)
with assert ...
(PT009)
395-395: Missing return type annotation for private function _assertHolidayNameCount
Add return type annotation: None
(ANN202)
395-395: Missing type annotation for *args
(ANN002)
407-407: Use a regular assert
instead of unittest-style assertIsInstance
Replace assertIsInstance(...)
with assert ...
(PT009)
409-409: Use a regular assert
instead of unittest-style assertEqual
Replace assertEqual(...)
with assert ...
(PT009)
437-437: Missing return type annotation for private function _assertNoHoliday
Add return type annotation: None
(ANN202)
437-437: Missing type annotation for *args
(ANN002)
442-442: Use a regular assert
instead of unittest-style assertNotIn
Replace assertNotIn(...)
with assert ...
(PT009)
477-477: Missing return type annotation for private function _assertLocalizedHolidays
Add return type annotation: None
(ANN202)
tests/countries/test_canada.py
22-22: Missing return type annotation for classmethod setUpClass
Add return type annotation: None
(ANN206)
⏰ 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). (4)
- GitHub Check: Test Python 3.14 on windows-latest
- GitHub Check: Test Python 3.9 on windows-latest
- GitHub Check: Test Python 3.13 on windows-latest
- GitHub Check: Test Python 3.10 on windows-latest
🔇 Additional comments (11)
tests/countries/test_brazil.py (4)
21-23
: Correct setUpClass mass-assign kwarg.years_all_subdivs is the right key for subdivision fixtures. Good catch fixing the earlier typo.
28-30
: Right choice: cover all supported categories in smoke test.Brazil defines OPTIONAL and PUBLIC; asserting across Brazil.supported_categories is intended here. Based on learnings.
60-71
: Good movable-holiday pattern (discrete years + full_range).This mirrors the suite’s standard and keeps coverage broad with specific spot checks. Based on learnings.
75-80
: Years-exclusion handling for Tiradentes looks solid.Set-based exclusion + negative assertion is clean and deterministic.
tests/countries/test_chile.py (1)
39-41
: All-category smoke test is appropriate.Chile has BANK and PUBLIC; covering Chile.supported_categories here is correct. Based on learnings.
tests/countries/test_bhutan.py (3)
21-23
: Good: delegate setup to harness.Using super().setUpClass(Bhutan) centralizes year config and fixtures.
27-29
: Correct pre-start bound.Checking no holidays at self.start_year - 1 matches Bhutan.start_year=2007.
32-58
: Adopting self.full_range is consistent and reduces boilerplate.Switching fixed ranges to self.full_range aligns with the new harness and improves coverage.
Also applies to: 86-100, 111-112, 124-150, 163-176, 189-189, 206-207, 237-238
tests/countries/test_canada.py (3)
22-24
: Harness setup with subdiv categories looks right.This enables subdiv_{category}_holidays and generated assertion helpers for CA.
28-31
: Good: validate pre-start across all supported categories.Using Canada.supported_categories ensures comprehensive no-holiday coverage.
If any province has a category with a later start than national PUBLIC, localized pre-start assertions should still pass; confirm CI times remain acceptable given added instances.
33-54
: Dynamic assertion helpers are used correctly and consistently.Category/subdivision variants and observed/non-observed checks align with the new TestCase sugar.
Also applies to: 79-117, 118-145, 147-187, 188-232, 233-279, 280-336, 341-377, 381-407, 415-488, 489-513, 514-577, 578-593, 611-641, 642-649, 650-669, 670-685, 686-702, 703-719, 720-735, 736-748, 749-766, 767-780, 781-789, 790-805, 813-919, 921-987, 989-1062
Proposed change
This was moved from #2874
1. Migrate financial markets and countrys entities which starts with A-C to use
cls.full_range
for holidays check that spans the full observable period (self.start_year
/self.end_year
), as well as converting them all to modern library-wide standards.2. Reduce TestCase SetUpClass duplication (no need to declare
year
andyear_non_observed
separately if they use the same period, for example)3. TestCase Syntactic Sugar Support
Step 3.1. Generate
years_[insert]
andholidays_[insert]
dynamically, in this particular pattern:_non_observed
flag supportislamic_no_estimated
in use in countries with Islamic calendar holidaysWORKDAY
,SCHOOL
, ... - fromsupported_categories
subdiv
support (both legacycls.subdiv_holidays
andassertSubdiv[Subdivision][methodname]
variants)Step 3.2. Automatically populate all
holidays_[insert
into testcases dynamically_assertHoliday
for all cases i.e.assertIslamicNoEstimatedNonObservedHoliday(self, *args)
_assertHolidayDates
for all cases i.e.assertIslamicNoEstimatedNonObservedHolidayDates(self, *args)
_assertHolidayName
for all cases i.e.assertIslamicNoEstimatedNonObservedHolidayName(self, name, *args)
_assertHolidays
for all cases i.e.assertIslamicNoEstimatedNonObservedHolidays(self, *args)
_assertHolidayNameCount
for all cases i.e.assertIslamicNoEstimatedNonObservedHolidayNameCount(self, *args)
_assertNoHoliday
for all cases i.e.assertNoIslamicNoEstimatedNonObservedHoliday(self, *args)
_assertNoHolidayName
for all cases i.e.assertNoIslamicNoEstimatedNonObservedHolidayName(self, name, *args)
_assertNoHolidays
for all cases i.e.assertIslamicNoEstimatedNonObservedHolidays(self, *args)
Resolves #2352 .
Resolves #2875 .
Type of change
holidays
functionality in general)Checklist
make check
locally; all checks and tests passed.