Skip to content

TestCase Syntactic Sugar Support#2881

Merged
arkid15r merged 125 commits intovacanza:devfrom
PPsyrius:testcase_syntactic_sugar
Nov 17, 2025
Merged

TestCase Syntactic Sugar Support#2881
arkid15r merged 125 commits intovacanza:devfrom
PPsyrius:testcase_syntactic_sugar

Conversation

@PPsyrius
Copy link
Copy Markdown
Collaborator

@PPsyrius PPsyrius commented Sep 1, 2025

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 and year_non_observed separately if they use the same period, for example)

  • 3. TestCase Syntactic Sugar Support

Step 3.1. Generate years_[insert] and holidays_[insert] dynamically, in this particular pattern:

holidays_[subdiv_subdivision]_[categories]_[special_flag]_[non_observed]
  • 3.1.1. _non_observed flag support
  • 3.1.2. special flag support i.e. islamic_no_estimated in use in countries with Islamic calendar holidays
  • 3.1.3. categories support i.e. WORKDAY, SCHOOL, ... - from supported_categories
  • 3.1.4. subdiv support (both legacy cls.subdiv_holidays and assertSubdiv[Subdivision][methodname] variants)

Step 3.2. Automatically populate all holidays_[insert into testcases dynamically

  • 3.2.1 Auto-populate _assertHoliday for all cases i.e. assertIslamicNoEstimatedNonObservedHoliday(self, *args)
  • 3.2.2 Auto-populate_assertHolidayDates for all cases i.e. assertIslamicNoEstimatedNonObservedHolidayDates(self, *args)
  • 3.2.3 Auto-populate_assertHolidayName for all cases i.e. assertIslamicNoEstimatedNonObservedHolidayName(self, name, *args)
  • 3.2.4 Auto-populate_assertHolidays for all cases i.e. assertIslamicNoEstimatedNonObservedHolidays(self, *args)
  • 3.2.5 Auto-populate_assertHolidayNameCount for all cases i.e. assertIslamicNoEstimatedNonObservedHolidayNameCount(self, *args)
  • 3.2.6 Auto-populate_assertNoHoliday for all cases i.e. assertNoIslamicNoEstimatedNonObservedHoliday(self, *args)
  • 3.2.7 Auto-populate_assertNoHolidayName for all cases i.e. assertNoIslamicNoEstimatedNonObservedHolidayName(self, name, *args)
  • 3.2.8 Auto-populate_assertNoHolidays for all cases i.e. assertIslamicNoEstimatedNonObservedHolidays(self, *args)

Resolves #2352 .
Resolves #2875 .

Type of change

  • New country/market holidays support (thank you!)
  • Supported country/market holidays update (calendar discrepancy fix, localization)
  • Existing code/documentation/test/process quality improvement (best practice, cleanup, refactoring, optimization)
  • Dependency update (version deprecation/pin/upgrade)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (a code change causing existing functionality to break)
  • New feature (new holidays functionality in general)

Checklist

@PPsyrius PPsyrius marked this pull request as draft September 1, 2025 03:52
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 1, 2025

Summary by CodeRabbit

Release Notes

  • Breaking Changes

    • Country holiday classes have been renamed for consistency (e.g., HolidaysAXAlandIslands, HolidaysASAmericanSamoa). Update your imports if using old class names.
    • Some country code aliases have been consolidated; use the main country class names instead.
  • Test Infrastructure

    • Modernized test framework with improved dynamic year range handling and category-specific assertions for better coverage.

Walkthrough

Refactors the test harness to support dynamic per-variant test instances and generated assertion helpers; migrates hundreds of tests to dynamic year/category bindings; renames/reparents many country and financial classes and updates registry and tests accordingly.

Changes

Cohort / File(s) Summary
Test harness core
tests/common.py
Add _get_or_create_lookup, _generate_assert_methods; rewrite setUpClass to produce cached per-variant calendars and dynamic test attributes; remove many static assertion wrappers; update argument/observation parsing; expose subdivision/category lookups.
Mass test migrations (year/variant-driven)
tests/countries/* (many files)
Replace hard-coded year windows with self.start_year/self.end_year/self.full_range; pass Country(years=...) where needed; adopt category-specific assertion helpers (government/school/workday/optional/islamic); update observed/non-observed handling and many test names.
Country class renames & alias reparenting
holidays/countries/*.py (examples: aland_islands.py, american_samoa.py, french_guiana.py, guadeloupe.py, guam.py, marshall_islands.py, mayotte.py, new_caledonia.py, northern_mariana_islands.py, puerto_rico.py, reunion.py, svalbard_and_jan_mayen.py, united_states_minor_outlying_islands.py, united_states_virgin_islands.py, wallis_and_futuna.py, ... )
Swap canonical class names to more descriptive ones, preserve legacy names as subclass aliases, and rewire alias inheritance chains across many country modules.
Country API: supported categories & per-category years
holidays/countries/* (selected)
Introduce/use supported_categories attributes and accept per-category year keyword args in some constructors (e.g., Argentina, Australia, Paraguay); tests updated to use category-aware constructors.
Islamic / no-estimate helpers
tests/countries/*
Replace private no-estimated fixtures with public test helpers (e.g., IslamicNoEstimatedHolidayName, IslamicNoEstimatedHolidayNameCount) and migrate tests to these helpers plus dynamic ranges.
Financial calendars & registry
holidays/financial/*, tests/financial/*, holidays/registry.py
Rename ICEFuturesEuropeIceFuturesEurope (keep wrapper aliases), add new export, update FINANCIAL registry tuple, add full_range to financial tests and migrate to dynamic-range assertions.
Minor tests / docs edits
tests/..., README.md
Numerous per-file test renames, year-scoped instance passing, localization tweaks, and README diacritic correction ("Åland Islands").

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~150+ minutes

Areas to focus during review:

  • tests/common.py — dynamic assertion generation, caching logic, and compatibility with existing test patterns.
  • Affected country modules that changed constructor or public attributes (e.g., Argentina per-category kwargs, Australia/Paraguay supported_categories).
  • Registry and financial rename (IceFuturesEurope) — ensure registry entries, imports, and backwards aliases are consistent.
  • Migration of Islamic/no-estimated helpers and any change from fixtures to helper APIs that affect counts and observed semantics.
  • Broad sweep of updated tests to ensure renamed classes/aliases preserve backward compatibility where necessary.

Possibly related PRs

Suggested reviewers

  • KJhellico

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.56% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly describes the main change—TestCase Syntactic Sugar Support—which aligns with the PR's primary objective of generating dynamic assertion methods.
Description check ✅ Passed Description is directly related to the changeset, detailing the migration of entities A–C, reduction of duplication, and implementation of dynamic assertion helpers.
Linked Issues check ✅ Passed Changes meet objectives from both #2352 and #2875: dynamic assertion helpers generated via generate_assert_methods [3.2.1-3.2.8], setUpClass refactored with years[...] parameters [3.2], and cls.full_range introduced across A–C tests.
Out of Scope Changes check ✅ Passed All changes align with stated scope: financial markets A–C countries migrated to modern standards with dynamic helpers, cls.full_range adoption, and setUpClass duplication reduction; no unrelated changes detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98d69c0 and 22750cb.

📒 Files selected for processing (2)
  • holidays/financial/__init__.py (1 hunks)
  • tests/countries/test_azerbaijan.py (4 hunks)
🧰 Additional context used
🧠 Learnings (42)
📓 Common learnings
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T21:12:07.224Z
Learning: KJhellico prefers to focus on completing and reviewing the main holiday implementation code before doing detailed reviews of the corresponding test files.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_faroe_islands.py:16-16
Timestamp: 2025-11-08T05:36:32.788Z
Learning: In PR #2881 onwards, the vacanza/holidays project moved to centralized alias testing via the `check_aliases` method in `tests/common.py`. Individual country test files no longer need to import country code aliases (e.g., FO, FRO for Faroe Islands) or define `test_country_aliases` methods. The common test framework automatically validates all aliases by dynamically importing them from the registry and calling `assertAliases`.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_algeria.py:28-30
Timestamp: 2025-09-18T03:19:23.722Z
Learning: In the vacanza/holidays project, tests now use self.start_year and self.end_year from the TestCase class instead of country-specific aliases (like DZ.start_year) for start_year and end_year references. This approach provides the test framework with better control over test year ranges rather than being tied to specific country start years.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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: PPsyrius
Repo: vacanza/holidays PR: 2386
File: tests/countries/test_nepal.py:499-536
Timestamp: 2025-04-05T06:49:06.217Z
Learning: In the holidays project, test files follow a dual testing approach: individual methods test specific holidays across multiple years, while comprehensive year-specific tests (e.g., `test_2025`) verify all holidays for a specific year in a single assertion. Both approaches serve different testing purposes and complement each other.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_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
Repo: vacanza/holidays PR: 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
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2530
File: tests/countries/test_andorra.py:23-28
Timestamp: 2025-05-06T21:07:11.577Z
Learning: In the holidays project, test methods for country holidays follow a standard form where year ranges are explicitly recreated in each test method rather than being stored as class variables, to maintain consistency across all country tests.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:85-86
Timestamp: 2025-04-05T04:29:38.042Z
Learning: For testing holiday implementations in the vacanza/holidays repository, recommend using `from tests.common import CommonCountryTests` as the base class instead of directly using `unittest.TestCase` to maintain consistency with project conventions and leverage common test utilities.
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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.
📚 Learning: 2025-09-18T03:19:23.722Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_algeria.py:28-30
Timestamp: 2025-09-18T03:19:23.722Z
Learning: In the vacanza/holidays project, tests now use self.start_year and self.end_year from the TestCase class instead of country-specific aliases (like DZ.start_year) for start_year and end_year references. This approach provides the test framework with better control over test year ranges rather than being tied to specific country start years.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-11-08T05:09:56.159Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_french_polynesia.py:19-22
Timestamp: 2025-11-08T05:09:56.159Z
Learning: In the vacanza/holidays project's test framework (PR #2881 onwards), the base class CommonCountryTests provides a default test_no_holidays implementation that automatically tests years=start_year - 1 for standard PUBLIC category cases. Individual country test files should only override test_no_holidays when the country supports additional non-PUBLIC categories (GOVERNMENT, WORKDAY, OPTIONAL, etc.) with different start years requiring separate validation.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-05-06T21:07:11.577Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2530
File: tests/countries/test_andorra.py:23-28
Timestamp: 2025-05-06T21:07:11.577Z
Learning: In the holidays project, test methods for country holidays follow a standard form where year ranges are explicitly recreated in each test method rather than being stored as class variables, to maintain consistency across all country tests.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-11-08T05:36:32.788Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_faroe_islands.py:16-16
Timestamp: 2025-11-08T05:36:32.788Z
Learning: In PR #2881 onwards, the vacanza/holidays project moved to centralized alias testing via the `check_aliases` method in `tests/common.py`. Individual country test files no longer need to import country code aliases (e.g., FO, FRO for Faroe Islands) or define `test_country_aliases` methods. The common test framework automatically validates all aliases by dynamically importing them from the registry and calling `assertAliases`.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-04-05T04:47:27.213Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-09-10T16:17:30.428Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_bosnia_and_herzegovina.py:21-24
Timestamp: 2025-09-10T16:17:30.428Z
Learning: Bosnia and Herzegovina holidays implementation currently lacks a start_year attribute. In tests/countries/test_bosnia_and_herzegovina.py, using cls.full_range = range(2000, 2050) is intentional to bound assertions and setup. Do not suggest replacing it with harness default full_range until start_year is introduced.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-09-14T16:05:55.205Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_iran.py:28-28
Timestamp: 2025-09-14T16:05:55.205Z
Learning: In tests/countries/test_iran.py, using years=(self.start_year - 1, 2102) in the no-holiday test is intentional because Iran uses the Persian Calendar which has specific supported year range constraints, and 2102 represents the upper limit of the Persian Calendar's supported range, not just an arbitrary far-future date.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-04-05T04:50:40.752Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-09-28T05:42:12.777Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_indonesia.py:221-223
Timestamp: 2025-09-28T05:42:12.777Z
Learning: In tests/countries/test_indonesia.py, the manual set inclusion checks using get_named and years_found for Lunar New Year (test_lunar_new_year) and Vesak Day (test_vesak_day) are intentional and should remain until both holidays get their own `{insert}_no_estimated` flags implemented, rather than using standard harness assertions like assertHolidayName/assertNoHolidayName.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-04-05T04:33:53.254Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-09-10T14:35:54.603Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_brazil.py:28-30
Timestamp: 2025-09-10T14:35:54.603Z
Learning: In the holidays project, the test_no_holidays method should test ALL supported_categories (via categories=CountryClass.supported_categories) rather than just the default PUBLIC category, to ensure comprehensive validation that no holidays exist before start_year across any supported category including OPTIONAL and subdivision categories.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-09-20T12:24:28.864Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-09-14T16:19:23.651Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-09-14T16:02:15.480Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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/countries/test_azerbaijan.py
📚 Learning: 2025-09-12T21:37:10.710Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 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/countries/test_azerbaijan.py
📚 Learning: 2025-09-04T09:48:11.738Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-09-04T09:48:11.738Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-09-02T08:02:03.604Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-04-05T06:49:06.217Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2386
File: tests/countries/test_nepal.py:499-536
Timestamp: 2025-04-05T06:49:06.217Z
Learning: In the holidays project, test files follow a dual testing approach: individual methods test specific holidays across multiple years, while comprehensive year-specific tests (e.g., `test_2025`) verify all holidays for a specific year in a single assertion. Both approaches serve different testing purposes and complement each other.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-04-05T04:29:38.042Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2416
File: tests/countries/test_turkmenistan.py:85-86
Timestamp: 2025-04-05T04:29:38.042Z
Learning: For testing holiday implementations in the vacanza/holidays repository, recommend using `from tests.common import CommonCountryTests` as the base class instead of directly using `unittest.TestCase` to maintain consistency with project conventions and leverage common test utilities.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_paraguay.py:134-139
Timestamp: 2025-09-17T09:07:56.459Z
Learning: In the vacanza/holidays project, 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_azerbaijan.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-09-17T09:07:56.459Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_paraguay.py:134-139
Timestamp: 2025-09-17T09:07:56.459Z
Learning: In the vacanza/holidays project, for holidays that start from a specific year (not the country's start_year), the standard pattern is to use `range(specific_year, self.end_year)` rather than `self.full_range` with year conditions. This maintains consistency across the codebase and clearly separates the holiday period from the pre-holiday period using `assertNoHolidayName(name, range(self.start_year, specific_year))`.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-09-14T16:03:13.558Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.558Z
Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-09-03T14:05:10.592Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are properly covered by the test_eid_al_fitr_day() method, which tests both the regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-09-25T08:56:22.473Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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/countries/test_azerbaijan.py
📚 Learning: 2025-06-18T17:01:58.067Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-09-14T06:39:32.896Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-09-03T16:49:35.246Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2881
File: tests/countries/test_argentina.py:375-375
Timestamp: 2025-09-03T16:49:35.246Z
Learning: In the holidays library, national holiday tests use self.full_range (or similar comprehensive year ranges) even when explicit test dates only show modern observance. This is intentional for correctness and comprehensive coverage, unlike subdivision-specific holidays which have explicit year boundaries based on known start dates.

Applied to files:

  • tests/countries/test_azerbaijan.py
📚 Learning: 2025-09-10T13:39:34.625Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-09-14T17:17:14.387Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-04-04T10:52:41.546Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are 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_azerbaijan.py
📚 Learning: 2025-09-14T16:23:46.707Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 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_azerbaijan.py
📚 Learning: 2025-08-08T14:37:03.045Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2774
File: tests/countries/test_liberia.py:15-16
Timestamp: 2025-08-08T14:37:03.045Z
Learning: In holidays/countries/__init__.py, re-export country classes using absolute imports (e.g., 'from holidays.countries.liberia import Liberia, LR, LBR') and keep alphabetical ordering (e.g., Lesotho, Liberia, Libya). Avoid relative imports in this file.

Applied to files:

  • holidays/financial/__init__.py
📚 Learning: 2025-08-08T14:37:03.045Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2774
File: tests/countries/test_liberia.py:15-16
Timestamp: 2025-08-08T14:37:03.045Z
Learning: When adding a new country in vacanza/holidays, also re-export it in holidays/countries/__init__.py (e.g., from .liberia import Liberia, LR, LBR) so tests and users can import from holidays.countries consistently.

Applied to files:

  • holidays/financial/__init__.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
Repo: vacanza/holidays PR: 2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.

Applied to files:

  • holidays/financial/__init__.py
📚 Learning: 2025-08-26T20:10:05.288Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2834
File: holidays/financial/national_stock_exchange_of_india.py:38-44
Timestamp: 2025-08-26T20:10:05.288Z
Learning: For National Stock Exchange of India (NSE) holidays implementation, only `estimated_label = tr("%s (estimated)")` is needed for localization support. The `observed_label` and `observed_estimated_label` are not required for this financial market holidays implementation.

Applied to files:

  • holidays/financial/__init__.py
📚 Learning: 2025-09-07T19:28:19.153Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2888
File: holidays/financial/national_stock_exchange_of_india.py:110-112
Timestamp: 2025-09-07T19:28:19.153Z
Learning: For National Stock Exchange of India (NSE) holidays implementation in holidays/financial/national_stock_exchange_of_india.py, "Mahatma Gandhi Jayanti" is the official name used in NSE source documentation for Gandhi Jayanti (October 2nd), even though snapshots and localization files may use the shorter "Gandhi Jayanti" form. Source accuracy takes precedence over standardization.

Applied to files:

  • holidays/financial/__init__.py
📚 Learning: 2025-08-09T18:31:23.218Z
Learnt from: KJhellico
Repo: vacanza/holidays PR: 2778
File: tests/countries/test_kiribati.py:15-15
Timestamp: 2025-08-09T18:31:23.218Z
Learning: In the holidays project test files, the standard import pattern is `from holidays.countries.<country> import Country, CODE1, CODE2` (used in ~97% of test files), not `from holidays.countries import Country, CODE1, CODE2`. Only a few exceptions (Suriname, Sierra Leone, Mauritius, Mali, Ivory Coast, Guyana) use the aggregated import pattern.

Applied to files:

  • holidays/financial/__init__.py
📚 Learning: 2025-08-21T05:56:33.276Z
Learnt from: PPsyrius
Repo: vacanza/holidays PR: 2843
File: holidays/countries/burundi.py:15-16
Timestamp: 2025-08-21T05:56:33.276Z
Learning: In the holidays library, when importing Gregorian month constants from holidays.calendars.gregorian, only import the months that are actually used in the date data. For example, if Islamic holiday dates only reference JUN, JUL, SEP, OCT, then only import those specific constants rather than importing additional unused months.

Applied to files:

  • holidays/financial/__init__.py
🧬 Code graph analysis (2)
tests/countries/test_azerbaijan.py (2)
holidays/countries/azerbaijan.py (1)
  • Azerbaijan (27-197)
tests/common.py (3)
  • WorkingDayTests (661-680)
  • TestCase (36-526)
  • setUpClass (117-282)
holidays/financial/__init__.py (1)
holidays/financial/ice_futures_europe.py (3)
  • IceFuturesEurope (17-41)
  • ICEFuturesEurope (44-45)
  • IFEU (48-49)
🪛 Ruff (0.14.4)
tests/countries/test_azerbaijan.py

22-22: Missing return type annotation for classmethod setUpClass

Add return type annotation: None

(ANN206)


134-134: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


146-146: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


197-197: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


197-197: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


210-210: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


210-210: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


210-210: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


224-224: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


233-233: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


255-255: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


255-255: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


255-255: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


284-284: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


284-284: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)


284-284: String contains ambiguous ı (LATIN SMALL LETTER DOTLESS I). Did you mean i (LATIN SMALL LETTER I)?

(RUF001)

⏰ 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.10 on windows-latest
  • GitHub Check: Test Python 3.11 on windows-latest
🔇 Additional comments (1)
holidays/financial/__init__.py (1)

15-15: Good addition of the canonical class name.

Exposing IceFuturesEurope (the main implementation) alongside its aliases ICEFuturesEurope and IFEU follows the established pattern in this file and improves API clarity. The ordering—canonical name first, then variants—is clean.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the test label Sep 1, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 515ba78 and 4c46ec3.

📒 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
Copy link
Copy Markdown

codecov bot commented Sep 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1a5effb) to head (22750cb).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #2881   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          306       306           
  Lines        18015     18015           
  Branches      2285      2285           
=========================================
  Hits         18015     18015           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a 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) over issubclass(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.

📥 Commits

Reviewing files that changed from the base of the PR and between 4c46ec3 and aa438a4.

📒 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 object

File: tests/common.py 536–545
Replace the .values() call on observed_rule with a mapping check so it won’t crash when observed_rule is an ObservedRule 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 None

Then use has_observed_rules in the existing if(estimated_label && observed_label && has_observed_rules): check.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a 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 — LGTM

Pattern mirrors Good Friday; concise coverage.


90-102: Orthodox Easter Sunday — LGTM

Adds newly implemented public holiday; full-range presence asserted.


103-115: Orthodox Easter Monday — LGTM

Consistent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between aa438a4 and 4b86312.

📒 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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 4b86312 and 796abd9.

📒 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 with make_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) to isinstance(args[0], HolidayBase) is more Pythonic.


235-238: Logic for observed flag validation.

The validation correctly checks that instances ending with _non_observed have observed=False and others have observed=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 to range(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 declares test_class=None, years=None, and uses **year_variants to absorb extra named arguments (e.g. years_non_observed), so existing super().setUpClass(...) calls continue to work without changes.

Likely an incorrect or invalid review comment.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 796abd9 and a285c74.

📒 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.

@github-actions github-actions bot added the l10n label Sep 2, 2025
@PPsyrius PPsyrius force-pushed the testcase_syntactic_sugar branch from 9f0aa54 to 6d3bf12 Compare September 2, 2025 05:13
@PPsyrius
Copy link
Copy Markdown
Collaborator Author

PPsyrius commented Sep 2, 2025

I've accidentally merge the wrong branch earlier - unrelated changes are now properly excluded again

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between a285c74 and 6d3bf12.

📒 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)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a 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 generator

Iterate 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 6d3bf12 and acf7314.

📒 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 good

Pattern matches existing financial tests; passing the base class with an explicit years range is correct.


29-29: Pre-start-year empty instance check is correct

Using start_year - 1 to assert no holidays is precise.


33-33: Universal Fraternization across full_range is fine

Deterministic year generator via cls.full_range.


63-64: Holy Thursday boundary is correct

Covers 1890–1999 inclusive; absent from 2000+.


76-76: Good Friday over full_range is fine

Matches provider behavior.


88-88: Worker’s Day pre-1925 absence check is correct

Aligns with provider’s year gate.


100-100: Corpus Christi over full_range is correct

Consistent with implementation.


104-104: Independence Day generator over full_range is correct

Deterministic coverage.


109-109: Our Lady of Aparecida pre-1980 absence is correct

Matches 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 correct

tests/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 using self.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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a 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.

📥 Commits

Reviewing files that changed from the base of the PR and between acf7314 and 37f0fba.

📒 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

Copy link
Copy Markdown
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is the biggest test framework upgrade since its introduction -- great work @PPsyrius and @KJhellico!
I'm really happy to see us moving in the right direction.

My initial plan was to merge it into v0.84 but I'd prefer to postpone it for another two weeks now, sorry about that.

While I've implemented some refactoring to make test cases cleaner where possible, I haven't yet reviewed the new common.py logic in detail. That, along with the fact that I touched non-test files as well, is my main reason for not including this in tomorrow's release.

Key updates:

  • Unified the test_aliases method
  • Unified the test_no_holidays method
  • Adjusted main class names for certain entities to stay consistent with the changes above

Beyond tests, I also updated some entity code, so this PR isn't as low-risk as originally planned. I've updated the Holidays?? naming while keeping it backward compatible.

Additional improvements include fixes for Mauritania, Saint Barthélemy (Unicode data replacement), Samoa, and ICE Futures Europe.

@KJhellico, @PPsyrius please review 8c82168 -- I hope I made it all right.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 16

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (7)
holidays/countries/guadeloupe.py (1)

31-32: Incorrect historical reference: Sweden never owned Guadeloupe.

The comment references "Cession from Sweden on May 30th, 1814," but Sweden never owned Guadeloupe. You may be confusing this with Saint Barthélemy, which Sweden ceded to France in 1878. Guadeloupe was French territory that was briefly occupied by Britain during the Napoleonic Wars and returned to France by the Treaty of Vienna in 1815.

The start_year = 1815 may still be appropriate (marking France's definitive return), but the comment needs correction.

Apply this diff to fix the historical reference:

-    # Cession from Sweden on May 30th, 1814.
+    # Returned to France by the Treaty of Vienna.
     start_year = 1815
holidays/countries/marshall_islands.py (1)

36-36: Fix the class name spelling to match "Marshall" (two 'l's).

The StaticHolidays class is referenced as MarshalIslandsStaticHolidays (one 'l'), but the country name is "Marshall Islands" (two 'l's). This creates inconsistency with the main MarshallIslands class name.

Apply this diff:

-        StaticHolidays.__init__(self, MarshalIslandsStaticHolidays)
+        StaticHolidays.__init__(self, MarshallIslandsStaticHolidays)

You'll also need to rename the class at line 94:

-class MarshalIslandsStaticHolidays:
+class MarshallIslandsStaticHolidays:
tests/countries/test_faroe_islands.py (2)

22-25: Add test_no_holidays and adopt cls.full_range pattern.

The test class is missing the standard test_no_holidays method and hasn't adopted the new framework pattern using cls.full_range to centralize year ranges.

Update the setUpClass to create cls.full_range:

     @classmethod
     def setUpClass(cls):
-        years = range(1949, 2050)
-        super().setUpClass(FaroeIslands, years=years)
-        cls.half_day_holidays = FaroeIslands(categories=HALF_DAY, years=years)
+        super().setUpClass(FaroeIslands, years=range(1949, 2050))
+        cls.full_range = range(cls.start_year, 2050)
+        cls.half_day_holidays = FaroeIslands(categories=HALF_DAY, years=cls.full_range)

Add the test_no_holidays method after test_country_aliases:

    def test_no_holidays(self):
        self.assertNoHolidays(
            FaroeIslands(categories=FaroeIslands.supported_categories, years=(self.start_year - 1,))
        )

Based on learnings


28-167: Replace hardcoded year ranges with cls.full_range.

The year range range(1949, 2050) is hardcoded in ~15 test methods. Once cls.full_range is introduced in setUpClass, use it throughout to centralize the configuration and reduce duplication.

For example, update test methods like:

     def test_new_years_day(self):
-        self.assertHolidayName("Nýggjársdagur", (f"{year}-01-01" for year in range(1949, 2050)))
+        self.assertHolidayName("Nýggjársdagur", (f"{year}-01-01" for year in self.full_range))
     def test_maundy_thursday(self):
         name = "Skírhósdagur"
         self.assertHolidayName(
             name,
             "2020-04-09",
             "2021-04-01",
             "2022-04-14",
             "2023-04-06",
             "2024-03-28",
             "2025-04-17",
         )
-        self.assertHolidayName(name, range(1949, 2050))
+        self.assertHolidayName(name, self.full_range)

Apply similar changes to all remaining test methods that use the hardcoded range.

tests/countries/test_cabo_verde.py (1)

465-507: Localization list is pulling in subdivision-only dates.

The default instance that assertLocalizedHolidays(...) spins up is the nationwide CaboVerde(year=2025) (no subdiv). All of the municipal entries in this expectation were just proven absent via the earlier self.assertNoHolidayName(...) checks, so this assertion can never pass. Please restrict the localized expectation to the national holidays or build the check against the relevant subdiv_* instances instead.

tests/countries/test_curacao.py (1)

234-249: Half-day holiday won’t ever show up in this localization check.

assertLocalizedHolidays relies on the public calendar. We already confirmed in test_new_years_eve that Vispu di Aña Nobo is absent from the public instance, so expecting it here will fail. Either drop it from the default expectation or run a dedicated localization assertion against the half-day variant.

tests/countries/test_cyprus.py (1)

165-195: Optional/bank dates won’t appear in the default localization snapshot.

This list includes Holy Saturday, Easter Tuesday, and Christmas Eve, yet we just proved via self.assertNoHolidayName(...) that the public calendar omits those optional/bank items. Because assertLocalizedHolidays also uses that public instance, the expectation will never materialize (same issue in the locale-specific variants below). Please limit the default localization to public holidays or assert the optional/bank names against their respective category instances.

♻️ Duplicate comments (4)
tests/countries/test_cambodia.py (1)

248-272: Same verification needed for Visaka Bochea and Royal Ploughing Ceremony tests.

Lines 259 and 272 also pass integer year ranges (self.full_range) directly to assertHolidayName. This follows the same pattern as test_meak_bochea and needs the same verification.

tests/countries/test_australia.py (2)

303-320: NT Picnic Day: full_range may over‑assert historical coverage.

Keep specific date checks; avoid asserting across self.full_range unless bounded to first supported NT year.


174-175: Sovereign’s Birthday “no‑name” ranges are too broad for 2023+.

The blanket absence for King/Queen over 1936..end_year conflicts with the 2023 rename back to “King’s Birthday.” Tighten the negative ranges.
Apply:

-        self.assertNoHolidayName(name_king, range(1936, self.end_year))
-        self.assertNoHolidayName(name_queen, range(1936, self.end_year))
+        self.assertNoHolidayName(name_king, range(1952, 2023))
+        self.assertNoHolidayName(
+            name_queen, range(self.start_year, 1952), range(2023, self.end_year)
+        )
tests/common.py (1)

64-108: Add function metadata and args validation to generated methods.

The dynamic method generation works but has two issues:

  1. Missing metadata: Generated methods lack __name__, __qualname__, and __doc__, making tracebacks show generic _method names instead of the actual assertion method called.

  2. No args validation: Lines 67 and 70 unpack args without checking length, which will raise a cryptic ValueError if insufficient arguments are passed.

Apply this to fix both issues:

         def make_assert(helper_func, instance_name, method_type):
             def _method(self, *args, **kwargs):
                 if method_type == "name_count":
+                    if len(args) < 2:
+                        raise TypeError(f"Expected (name, count, ...) arguments for {instance_name}")
                     name, count, *rest = args
                     return helper_func(self, name, count, instance_name, *rest, **kwargs)
                 elif method_type == "name":
+                    if not args:
+                        raise TypeError(f"Expected (name, ...) arguments for {instance_name}")
                     name, *rest = args
                     return helper_func(self, name, instance_name, *rest, **kwargs)
                 else:
                     return helper_func(self, instance_name, *args, **kwargs)
 
             return _method
 
         method_specs = {
             "_assertHoliday": "assert{variant}Holiday",
             "_assertHolidayDates": "assert{variant}HolidayDates",
             "_assertHolidayName": "assert{variant}HolidayName",
             "_assertHolidayNameCount": "assert{variant}HolidayNameCount",
             "_assertHolidays": "assert{variant}Holidays",
             "_assertNoHoliday": "assertNo{variant}Holiday",
             "_assertNoHolidayName": "assertNo{variant}HolidayName",
             "_assertNoHolidays": "assertNo{variant}Holidays",
         }
 
         method_types = {
             "_assertHolidayNameCount": "name_count",
             "_assertHolidayName": "name",
             "_assertNoHolidayName": "name",
         }
 
         for attr_name in dir(cls):
             if not attr_name.startswith("holidays"):
                 continue
 
             variant = attr_name.removeprefix("holidays")
             pretty_variant = "".join(part.capitalize() for part in variant.strip("_").split("_"))
 
             for helper_name, template in method_specs.items():
                 method_name = template.format(variant=pretty_variant)
                 if hasattr(cls, method_name):
                     continue
 
                 helper = getattr(cls, helper_name)
                 method_type = method_types.get(helper_name, "default")
-                setattr(cls, method_name, make_assert(helper, attr_name, method_type))
+                fn = make_assert(helper, attr_name, method_type)
+                fn.__name__ = method_name
+                fn.__qualname__ = f"{cls.__name__}.{method_name}"
+                fn.__doc__ = helper.__doc__
+                setattr(cls, method_name, fn)

@sonarqubecloud
Copy link
Copy Markdown

@arkid15r arkid15r enabled auto-merge November 17, 2025 03:55
Copy link
Copy Markdown
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge this one and take care of the minor improvements later?
@KJhellico, @PPsyrius any objections?

@PPsyrius
Copy link
Copy Markdown
Collaborator Author

I think we can merge it now and add other fixes later (if needed) - this only affects development side of things anyway

@arkid15r
Copy link
Copy Markdown
Collaborator

I think we can merge it now and add other fixes later (if needed) - this only affects development side of things anyway

Just a reminder that I added some changes in holidays/countries and holidays/financial but they seem 100% backward compatible.

Copy link
Copy Markdown
Collaborator

@KJhellico KJhellico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@arkid15r arkid15r added this pull request to the merge queue Nov 17, 2025
Merged via the queue into vacanza:dev with commit aa817b4 Nov 17, 2025
33 checks passed
@KJhellico KJhellico mentioned this pull request Nov 17, 2025
@PPsyrius PPsyrius deleted the testcase_syntactic_sugar branch November 18, 2025 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

General Test Case Refactor Extend base common::TestCase with category specific methods

3 participants