+
Skip to content

Conversation

PPsyrius
Copy link
Collaborator

Proposed change

Add Afghanistan's 2025 exact Islamic holidays observances.

This is part of the non-test case changes decoupling from #2881

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

Copy link
Contributor

coderabbitai bot commented Sep 16, 2025

Summary by CodeRabbit

  • New Features
    • Added confirmed 2025 Afghanistan Islamic holiday dates: Ramadan start (Mar 1), Eid al-Fitr (Mar 30–Apr 1), Arafah Day (Jun 6), Eid al-Adha (Jun 7–9), Prophet’s Birthday (Sep 5).
  • Bug Fixes
    • Removed “estimated” labels and aligned 2025 dates with official calendars, including one-day shifts where applicable.
  • Documentation
    • Updated reference link to a 2025 source.
  • Tests
    • Extended tests to cover 2025 holiday dates and corrected a test name for localization defaults.

Walkthrough

Extends Afghanistan Islamic holiday confirmed year ranges to 2025 and adds 2025 specific dates. Updates an archived documentation link in the Afghanistan class docstring. Refreshes AF snapshot data to remove “estimated” and adjust 2025 dates. Updates tests to include 2025 dates and renames one test method.

Changes

Cohort / File(s) Summary
Afghanistan Islamic dates update
holidays/countries/afghanistan.py
Extended confirmed-year ranges to 2025 for Ramadan start, Eid al-Fitr, Eid al-Adha, and Mawlid; added 2025 entries for Eid al-Adha (JUN 7) and Mawlid (SEP 5); updated archived reference link in docstring.
Snapshots adjustments
snapshots/countries/AF_COMMON.json
For 2025, removed “(estimated)” from Ramadan, Eid al-Fitr, Eid al-Adha, Arafah, and Prophet’s Birthday; shifted dates: Arafah to 2025-06-06; Eid al-Adha to 2025-06-07..09; Mawlid to 2025-09-05.
Tests update
tests/countries/test_afghanistan.py
Added 2025 expectations (Ramadan start, Eid al-Fitr, Arafah, Eid al-Adha, Mawlid); renamed method test_l10_default → test_l10n_default.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

snapshot, test

Suggested reviewers

  • KJhellico

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately summarizes the primary change: adding exact 2025 Islamic holiday observances for Afghanistan. It is specific to the country and the update, uses clear phrasing, and avoids noisy or vague wording, so a reviewer scanning history will understand the main intent.
Description Check ✅ Passed The PR description clearly states the proposed change (adding Afghanistan's 2025 exact Islamic holiday observances), links the change to a related PR, and classifies the update as a supported country/market holidays update; this directly matches the file, snapshot, and test updates in the provided summary. The description is on-topic and provides sufficient context for reviewers.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • 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 7347cd0 and f55555b.

📒 Files selected for processing (3)
  • holidays/countries/afghanistan.py (4 hunks)
  • snapshots/countries/AF_COMMON.json (1 hunks)
  • tests/countries/test_afghanistan.py (6 hunks)
🧰 Additional context used
🧠 Learnings (20)
📓 Common learnings
Learnt from: PPsyrius
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:146-159
Timestamp: 2025-03-19T16:54:58.657Z
Learning: In the holidays library implementation, explicit holiday dates (like Diwali in Fiji) are only defined for historical years with official sources (2016-2025). Future dates beyond the explicitly defined range are automatically calculated by methods like `_add_diwali`, which provide approximations when official dates aren't yet available.
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_iran.py:28-28
Timestamp: 2025-09-14T16:05:55.181Z
Learning: In tests/countries/test_iran.py, using years=(self.start_year - 1, 2102) in the no-holiday test is intentional because Iran uses the Persian Calendar which has specific supported year range constraints, and 2102 represents the upper limit of the Persian Calendar's supported range, not just an arbitrary far-future date.
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:171-183
Timestamp: 2025-03-29T15:15:05.919Z
Learning: In the Fiji holidays implementation, the maintainers are aware of the need to extend the MAWLID_DATES dictionary beyond 2025 when future official references become available, and will do so when appropriate. No suggestions about extending this dictionary should be made in future reviews.
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_south_africa.py:22-22
Timestamp: 2025-09-14T04:41:10.130Z
Learning: South Africa's observed holiday system only started in 1995, so in tests/countries/test_south_africa.py, using years_non_observed=range(1995, 2050) is intentional to limit testing to years where observed holidays actually exist, improving both correctness and performance.
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bulgaria.py:21-23
Timestamp: 2025-09-14T16:14:44.954Z
Learning: For Bulgaria in the holidays library, using years_non_observed=range(2017, 2030) in tests/countries/test_bulgaria.py is intentional because all observed holiday examples in the test data fall within this range (latest being 2029), making this range appropriate for limiting testing to years where observed holidays actually exist, improving both correctness and performance.
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bulgaria.py:21-23
Timestamp: 2025-09-14T16:14:44.954Z
Learning: For Bulgaria in the holidays library, using years_non_observed=range(2017, 2030) in tests/countries/test_bulgaria.py is intentional because all observed holiday examples in the test data fall within this range (latest being 2029), making this range appropriate for limiting testing to years where observed holidays actually exist.
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).
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.496Z
Learning: In tests/countries/test_barbados.py, using years_non_observed=range(2000, 2024) is intentional because all observed holiday examples fall within 2001-2023, making this range appropriate for limiting testing to years where observed holidays actually exist in the test data.
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bosnia_and_herzegovina.py:21-24
Timestamp: 2025-09-10T16:17:30.428Z
Learning: Bosnia and Herzegovina holidays implementation currently lacks a start_year attribute. In tests/countries/test_bosnia_and_herzegovina.py, using cls.full_range = range(2000, 2050) is intentional to bound assertions and setup. Do not suggest replacing it with harness default full_range until start_year is introduced.
Learnt from: PPsyrius
PR: vacanza/holidays#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-08-21T06:52:25.511Z
Learnt from: PPsyrius
PR: vacanza/holidays#2843
File: holidays/countries/burundi.py:140-155
Timestamp: 2025-08-21T06:52:25.511Z
Learning: In the holidays library Islamic calendar implementation, CONFIRMED_YEARS represents the full range of years that have been officially verified, while the individual EID_AL_FITR_DATES and EID_AL_ADHA_DATES dictionaries only contain entries for years where the official dates differ from the base Umm al-Qura algorithmic calculations. Years within CONFIRMED_YEARS but not in the explicit date dictionaries will use the base algorithm but be marked as "confirmed" rather than "estimated".

Applied to files:

  • holidays/countries/afghanistan.py
📚 Learning: 2025-03-29T15:15:05.919Z
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:171-183
Timestamp: 2025-03-29T15:15:05.919Z
Learning: In the Fiji holidays implementation, the maintainers are aware of the need to extend the MAWLID_DATES dictionary beyond 2025 when future official references become available, and will do so when appropriate. No suggestions about extending this dictionary should be made in future reviews.

Applied to files:

  • holidays/countries/afghanistan.py
  • snapshots/countries/AF_COMMON.json
📚 Learning: 2025-03-19T16:54:58.657Z
Learnt from: PPsyrius
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:146-159
Timestamp: 2025-03-19T16:54:58.657Z
Learning: In the holidays library implementation, explicit holiday dates (like Diwali in Fiji) are only defined for historical years with official sources (2016-2025). Future dates beyond the explicitly defined range are automatically calculated by methods like `_add_diwali`, which provide approximations when official dates aren't yet available.

Applied to files:

  • holidays/countries/afghanistan.py
  • tests/countries/test_afghanistan.py
📚 Learning: 2025-05-06T13:01:22.693Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2522
File: holidays/countries/yemen.py:158-163
Timestamp: 2025-05-06T13:01:22.693Z
Learning: In the holidays library, the RAMADAN_BEGINNING_DATES dictionary in country-specific Islamic holiday classes (like YemenIslamicHolidays) is used indirectly through the backend. When a country class calls _add_holiday_29_ramadan(), the IslamicHolidays implementation uses the country's custom calendar dates to calculate the 29th day of Ramadan by adding 28 days to the beginning date.

Applied to files:

  • holidays/countries/afghanistan.py
  • snapshots/countries/AF_COMMON.json
📚 Learning: 2025-04-13T20:41:56.613Z
Learnt from: KJhellico
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:266-284
Timestamp: 2025-04-13T20:41:56.613Z
Learning: The Islamic holiday dates in the holidays library should only include officially verified dates, not predicted ones, to maintain accuracy. This is especially important for holidays that depend on lunar observations like Eid al-Fitr and Eid al-Adha.

Applied to files:

  • holidays/countries/afghanistan.py
  • snapshots/countries/AF_COMMON.json
📚 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_afghanistan.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_afghanistan.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_afghanistan.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_afghanistan.py
📚 Learning: 2025-09-14T16:05:55.181Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_iran.py:28-28
Timestamp: 2025-09-14T16:05:55.181Z
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_afghanistan.py
📚 Learning: 2025-09-14T04:41:10.130Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_south_africa.py:22-22
Timestamp: 2025-09-14T04:41:10.130Z
Learning: South Africa's observed holiday system only started in 1995, so in tests/countries/test_south_africa.py, using years_non_observed=range(1995, 2050) is intentional to limit testing to years where observed holidays actually exist, improving both correctness and performance.

Applied to files:

  • tests/countries/test_afghanistan.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_afghanistan.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_afghanistan.py
📚 Learning: 2025-09-14T16:03:13.496Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_barbados.py:21-23
Timestamp: 2025-09-14T16:03:13.496Z
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_afghanistan.py
📚 Learning: 2025-09-03T14:05:10.592Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_aruba.py:77-79
Timestamp: 2025-09-03T14:05:10.592Z
Learning: The assertNoHolidayName helper method in the vacanza/holidays test framework accepts both individual years (scalars) and iterables of years, making calls like assertNoHolidayName(name, AW.start_year, range(2023, 2050)) valid where AW.start_year is a single integer year.

Applied to files:

  • tests/countries/test_afghanistan.py
📚 Learning: 2025-09-14T16:14:44.954Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bulgaria.py:21-23
Timestamp: 2025-09-14T16:14:44.954Z
Learning: For Bulgaria in the holidays library, using years_non_observed=range(2017, 2030) in tests/countries/test_bulgaria.py is intentional because all observed holiday examples in the test data fall within this range (latest being 2029), making this range appropriate for limiting testing to years where observed holidays actually exist, improving both correctness and performance.

Applied to files:

  • tests/countries/test_afghanistan.py
📚 Learning: 2025-09-14T16:14:44.954Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_bulgaria.py:21-23
Timestamp: 2025-09-14T16:14:44.954Z
Learning: For Bulgaria in the holidays library, using years_non_observed=range(2017, 2030) in tests/countries/test_bulgaria.py is intentional because all observed holiday examples in the test data fall within this range (latest being 2029), making this range appropriate for limiting testing to years where observed holidays actually exist.

Applied to files:

  • tests/countries/test_afghanistan.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/countries/test_afghanistan.py
📚 Learning: 2025-06-25T10:36:39.103Z
Learnt from: PPsyrius
PR: vacanza/holidays#2678
File: tests/countries/test_puerto_rico.py:84-108
Timestamp: 2025-06-25T10:36:39.103Z
Learning: In the holidays library, test methods (including localization test methods like test_l10n_th, test_l10n_default) follow a standard library-wide approach of not including docstrings. This is the established convention across the codebase.

Applied to files:

  • tests/countries/test_afghanistan.py
🧬 Code graph analysis (1)
tests/countries/test_afghanistan.py (1)
tests/countries/test_philippines.py (1)
  • test_l10n_default (493-517)
🔇 Additional comments (12)
holidays/countries/afghanistan.py (5)

26-26: Good: switched to an archived reference.

Stable archived Timeanddate snapshot improves long‑term verifiability.


154-165: Mawlid 2025 added and confirmation window extended.

Entry 2025-09-05 matches tests/snapshot; no further action.


167-171: Ramadan beginning confirmation window extended.

Keeping the dictionary sparse is consistent; only override when diverging from base.


134-142: Approve — Eid al‑Adha 2025 and confirmed-year range are correct.
Verified: Arafah was observed on June 6, 2025 and Eid al‑Adha on June 7, 2025; adding 2025: (JUN, 7) and extending CONFIRMED_YEARS to 2025 is correct.


144-152: Eid al‑Fitr 2025 — no explicit override needed

Verified: Afghanistan observed Eid al‑Fitr Mar 30–Apr 1, 2025 (AP, OfficeHolidays, FedEE); keep EID_AL_FITR_DATES as-is and rely on the base Umm al‑Qura calculation unless you need to force a specific 2025 date.

tests/countries/test_afghanistan.py (6)

133-134: Add 2025 Mawlid expectation—OK.

Matches library data and snapshot.


152-153: Add 2025 First Day of Ramadan—OK.

Consistent with AF snapshot and confirmed‑years change.


214-215: Add 2025 Arafah—OK.

Consistent with Adha 2025-06-07.


255-258: Add 2025 Eid al‑Adha (3 days)—OK.

Matches new constant and snapshot.


279-295: Rename to test_l10n_default—good consistency with suite.

Naming aligns with library convention seen in other country tests.


193-196: Approve: 2025 Eid al‑Fitr (3 days)

Verified — Taliban/official announcements and regional confirmations set Shawwal 1 = March 30, 2025; Mar 30–Apr 1, 2025 is correct.

snapshots/countries/AF_COMMON.json (1)

1040-1053: 2025 AF entries refreshed—looks consistent across code/tests.

Removal of “(estimated)” and date adjustments match constants and test assertions.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Ruff (0.12.2)
holidays/countries/afghanistan.py

�[1;31mruff failed�[0m
�[1mCause:�[0m Failed to load configuration /ruff.toml
�[1mCause:�[0m Failed to parse /ruff.toml
�[1mCause:�[0m TOML parse error at line 26, column 3
|
26 | "RSE100", # Use of assert detected
| ^^^^^^^^
Unknown rule selector: RSE100

tests/countries/test_afghanistan.py

�[1;31mruff failed�[0m
�[1mCause:�[0m Failed to load configuration /ruff.toml
�[1mCause:�[0m Failed to parse /ruff.toml
�[1mCause:�[0m TOML parse error at line 26, column 3
|
26 | "RSE100", # Use of assert detected
| ^^^^^^^^
Unknown rule selector: RSE100


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.

Copy link

Copy link

codecov bot commented Sep 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7347cd0) to head (f55555b).
⚠️ Report is 2 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #2932   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          296       296           
  Lines        17593     17593           
  Branches      2270      2270           
=========================================
  Hits         17593     17593           

☔ 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
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!

Copy link
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.

LGTM

@arkid15r arkid15r added this pull request to the merge queue Sep 16, 2025
Merged via the queue into vacanza:dev with commit 8c16b97 Sep 16, 2025
36 checks passed
@PPsyrius PPsyrius deleted the afg_2025 branch September 17, 2025 02:59
@arkid15r arkid15r mentioned this pull request Oct 6, 2025
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.

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载