Skip to content

Refactor Australia holidays#2828

Merged
arkid15r merged 3 commits into
vacanza:devfrom
KJhellico:ref-australia
Aug 19, 2025
Merged

Refactor Australia holidays#2828
arkid15r merged 3 commits into
vacanza:devfrom
KJhellico:ref-australia

Conversation

@KJhellico

Copy link
Copy Markdown
Collaborator

Proposed change

Refactor Australia holidays.
Resolves #2825.

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

@coderabbitai

coderabbitai Bot commented Aug 19, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes

    • Corrected observed holiday dates across Australia (national and state/territory), including New Year’s Day, Australia Day, ANZAC Day, Christmas Day, and Boxing Day.
    • Removed duplicate or incorrect labels on certain dates; NSW no longer shows spurious “ANZAC Day (observed)” in select years.
    • Adjusted VIC December holiday dates (1999, 2004, 2005) and NT Boxing Day labeling (2033, 2039, 2044, 2050) for accuracy.
  • Tests

    • Updated tests to align with revised holiday observations and datasets.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected observed holiday dates and labels across Australian states/territories for New Year’s Day, Australia Day, ANZAC Day, Christmas Day, and Boxing Day.
    • NT: Removed duplicate “Christmas Day (observed)” on Dec 27 for 2033, 2039, 2044, 2050.
    • VIC: Adjusted Christmas/Boxing Day dates for 1999, 2004, 2005; removed incorrect Dec 28 entries.
    • Standardized Monday-shifting rules, reducing duplicate “observed” labels and ensuring consistent results.
  • Tests

    • Updated subdivision holiday tests to reflect corrected dates and labels.

Walkthrough

Refactors Australian holiday observance to use date-driven rules and new move-rule constants (SAT_TO_NEXT_MON, ALL_TO_NEXT_MON); replaces per-year label logic with centralized _move_holiday/_add_observed flows for New Year’s Day, Australia Day, ANZAC Day, Christmas and Boxing Day across all subdivisions and updates snapshots and a test helper.

Changes

Cohort / File(s) Summary
AU rules refactor
holidays/countries/australia.py
Adds imports for SAT_TO_NEXT_MON and ALL_TO_NEXT_MON; replaces ad hoc weekend/year checks with dt-based _move_holiday/_add_observed patterns for New Year’s Day, Australia Day, ANZAC Day, Christmas Day, Boxing Day and related observed logic across ACT/NSW/NT/QLD/SA/TAS/VIC/WA; suppresses duplicate observed labels and centralizes year-specific rules.
Snapshots NT
snapshots/countries/AU_NT.json
Removes duplicate combined labeling on 2033-12-27, 2039-12-27, 2044-12-27, 2050-12-27 so entries now show only “Boxing Day (observed)”.
Snapshots VIC
snapshots/countries/AU_VIC.json
Adjusts Boxing Day/Christmas Day dates for 1999, 2004, 2005 to align with new observation rules and removes obsolete 12-28 entries.
Tests helper
tests/countries/test_australia.py
Renames _assertVariableDays parameter to subdiv_holidays_mapping; iterates over a precomputed mapping instead of per-year constructed objects; updates loop variables and membership checks and adds a minor typing annotation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Assessment against linked issues

Objective Addressed Explanation
Fix duplicate observed label for AU (#2825)

Out-of-scope changes

No out-of-scope functional changes detected in this diff.

Possibly related PRs

Suggested reviewers

  • arkid15r
  • PPsyrius

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov

codecov Bot commented Aug 19, 2025

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #2828   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          286       286           
  Lines        17120     17036   -84     
  Branches      2255      2228   -27     
=========================================
- Hits         17120     17036   -84     

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (1)
holidays/countries/australia.py (1)

1-907: Update audit script to account for valid Christmas/Boxing Day shifts

The NT and VIC snapshots for 2016/2022 were flagged as “issues” (e.g. Christmas Day (observed) on Dec 26 + Boxing Day on Dec 27), but that matches the intended _move_holiday logic (no duplicate “(observed)” and correct Mon→Tue shift). To avoid false positives:

• Extend the RG/JSON checks to accept these valid patterns:
– Christmas Day (observed) on 26 and Boxing Day on 27 (no “(observed)”)
– Boxing Day on 26 (no “(observed)”) and Christmas Day (observed) on 27

• In the Python sanity check, add clauses such as:

    or ("Christmas Day (observed)" in s26 and "Boxing Day" in s27)
    or ("Boxing Day" in s26 and "Christmas Day (observed)" in s27)

• Tighten the regex to only match true duplicate “(observed) (observed)” occurrences.

Once updated, rerun the audit to confirm no genuine duplicates remain.

📜 Review details

Configuration used: .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 8a35942 and ac72003.

📒 Files selected for processing (4)
  • holidays/countries/australia.py (21 hunks)
  • snapshots/countries/AU_NT.json (4 hunks)
  • snapshots/countries/AU_VIC.json (3 hunks)
  • tests/countries/test_australia.py (1 hunks)
🧰 Additional context used
🧠 Learnings (21)
📓 Common learnings
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#2623
File: holidays/countries/christmas_island.py:110-112
Timestamp: 2025-07-09T20:27:37.760Z
Learning: In Christmas Island, ANZAC Day (April 25) follows the same observed holiday rules as other holidays, using the SAT_SUN_TO_NEXT_MON rule to move to Monday when it falls on a weekend. The implementation correctly uses `_add_observed` wrapper around `_add_anzac_day`.
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:63-70
Timestamp: 2025-03-23T10:11:50.465Z
Learning: In the holidays library, the `SAT_SUN_TO_NEXT_MON_TUE` rule is specifically used for consecutive holidays (like Christmas Day and Boxing Day) to ensure they're observed on separate weekdays (Monday and Tuesday) when they fall on weekends, while `SAT_SUN_TO_NEXT_MON` is used as the default rule for other holidays.
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.
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.
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.
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
PR: vacanza/holidays#2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.

Applied to files:

  • snapshots/countries/AU_NT.json
📚 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_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_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_australia.py
  • snapshots/countries/AU_VIC.json
  • holidays/countries/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_australia.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_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_australia.py
📚 Learning: 2025-06-15T11:52:39.572Z
Learnt from: PPsyrius
PR: vacanza/holidays#2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.

Applied to files:

  • tests/countries/test_australia.py
📚 Learning: 2025-06-18T10:38:45.677Z
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_france.py:70-73
Timestamp: 2025-06-18T10:38:45.677Z
Learning: In the holidays library, the `assertDeprecatedSubdivisions` method uses a generic hard-coded message ("This subdivision is deprecated and will be removed") for all deprecated subdivision tests. This is the library-wide standard pattern, not specific to individual countries.

Applied to files:

  • 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_australia.py
  • holidays/countries/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_australia.py
  • holidays/countries/australia.py
📚 Learning: 2025-07-09T20:27:37.760Z
Learnt from: KJhellico
PR: vacanza/holidays#2623
File: holidays/countries/christmas_island.py:110-112
Timestamp: 2025-07-09T20:27:37.760Z
Learning: In Christmas Island, ANZAC Day (April 25) follows the same observed holiday rules as other holidays, using the SAT_SUN_TO_NEXT_MON rule to move to Monday when it falls on a weekend. The implementation correctly uses `_add_observed` wrapper around `_add_anzac_day`.

Applied to files:

  • snapshots/countries/AU_VIC.json
  • holidays/countries/australia.py
📚 Learning: 2025-03-23T10:11:50.465Z
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:63-70
Timestamp: 2025-03-23T10:11:50.465Z
Learning: In the holidays library, the `SAT_SUN_TO_NEXT_MON_TUE` rule is specifically used for consecutive holidays (like Christmas Day and Boxing Day) to ensure they're observed on separate weekdays (Monday and Tuesday) when they fall on weekends, while `SAT_SUN_TO_NEXT_MON` is used as the default rule for other holidays.

Applied to files:

  • holidays/countries/australia.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:

  • holidays/countries/australia.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants like FEB, TUE, MAR, and SUN internally through parent class implementations even when these constants don't appear directly in the file.

Applied to files:

  • holidays/countries/australia.py
📚 Learning: 2025-06-16T12:28:31.641Z
Learnt from: PPsyrius
PR: vacanza/holidays#2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.

Applied to files:

  • holidays/countries/australia.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:

  • holidays/countries/australia.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:

  • holidays/countries/australia.py
📚 Learning: 2025-07-14T20:23:48.198Z
Learnt from: KJhellico
PR: vacanza/holidays#2654
File: holidays/countries/cabo_verde.py:133-141
Timestamp: 2025-07-14T20:23:48.198Z
Learning: The holidays library provides helper methods `_add_holiday_2nd_sun_of_may()` and `_add_holiday_3rd_sun_of_jun()` for adding holidays on the 2nd Sunday of May and 3rd Sunday of June respectively. These methods are used across multiple country implementations including Latvia, Finland, Belarus, Malaysia, Madagascar, and Cape Verde.

Applied to files:

  • holidays/countries/australia.py
📚 Learning: 2025-07-08T10:20:04.069Z
Learnt from: KJhellico
PR: vacanza/holidays#2701
File: holidays/countries/palestine.py:131-131
Timestamp: 2025-07-08T10:20:04.069Z
Learning: In Palestine, both the first and second days of Christmas (Orthodox and Catholic) are holidays. The first day is a nationwide public holiday, while the second day is a holiday for the relevant religious groups (Catholic or Orthodox) with the same name. The implementation correctly uses `_add_christmas_day` for nationwide holidays and `_add_christmas_day_two` for group-specific second days.

Applied to files:

  • holidays/countries/australia.py
🧬 Code Graph Analysis (1)
holidays/countries/australia.py (3)
holidays/groups/international.py (2)
  • _add_new_years_day (142-150)
  • _add_anzac_day (43-56)
holidays/observed_holiday_base.py (2)
  • _add_observed (144-196)
  • _move_holiday (198-206)
holidays/groups/christian.py (2)
  • _add_christmas_day_two (234-242)
  • _add_christmas_day (224-232)
🔇 Additional comments (15)
snapshots/countries/AU_VIC.json (3)

452-452: VIC 1999 Boxing Day move looks correct.

1999-12-26 was a Sunday, so moving Boxing Day to Monday 1999-12-27 aligns with VIC’s 1994–2007 rule (SUN → MON). LGTM.


498-499: VIC 2004 weekend handling aligns with pre-2008 rules.

  • Christmas Day remains on 2004-12-25 (Saturday) without an observed shift (pre-2008 VIC didn’t move/observe Christmas).
  • Boxing Day on 2004-12-26 (Sunday) correctly observed/moved to 2004-12-27 (MON) per 1994–2007 rule.

Consistent and correct.


508-508: VIC 2005 correction matches policy.

Christmas Day on 2005-12-25 (Sunday) not moved; Boxing Day on 2005-12-26 (Monday) — removal of the prior 2005-12-27 entry is correct for pre-2008.

snapshots/countries/AU_NT.json (1)

984-984: No duplicate “(observed)” labels found across AU snapshots

I ran the suggested grep command across snapshots/countries/AU_*.json and found zero instances of "(observed)(observed)". All AU snapshots—including AU_NT.json—now correctly use a single “(observed)” label. Changes approved.

holidays/countries/australia.py (11)

156-165: ACT: unified move/observe rules look accurate.

  • New Year’s Day: 1959–1992 SUN→MON; 1993–2014 SAT/SUN→MON; 2015+ add observed — implemented correctly via _move/_add_observed.
  • Australia Day: 1959–1989 ALL→MON; 1990+ SAT/SUN→MON — implemented with ALL_TO_NEXT_MON vs SAT_SUN_TO_NEXT_MON.
  • ANZAC Day: from 1959 SUN→MON move without observed labeling — aligned with practice.

Nicely avoids duplicate labels via show_observed_label=False where moving.

Also applies to: 170-179, 193-198


241-269: ACT: Boxing Day before Christmas Day prevents collision; correct rules for split-Mon/Tue observation.

Placing Boxing Day first and using SAT_SUN_TO_NEXT_MON_TUE (+ MON_TO_NEXT_TUE for legacy windows) ensures distinct Mon/Tue observances and eliminates double-label scenarios.


361-366: NT: rules align with statutes and fix duplicated labels.

  • New Year’s: 2017+ add observed; 1982–2016 move.
  • Australia Day: 1982+ move.
  • ANZAC Day: 1982+ SUN→MON move.
  • Boxing Day/Christmas Day: correct pre-2023 move vs 2023+ add observed split, with Boxing Day before Christmas Day to prevent overlap and label duplication.

All consistent with the intent of #2825.

Also applies to: 371-375, 379-384, 408-415, 421-426


542-550: SA: careful SAT vs SUN handling; please confirm ANZAC change post-2023.

  • New Year’s and Australia Day: split handling for SAT (move) vs SUN (add, or move in 2024+) is correctly composed via _add_observed + _move_holiday.
  • Proclamation Day sequencing/rules across eras look correct.
  • ANZAC Day: removing observed from 2024 (no MON when SUN) reflects recent changes — please confirm this with the 2023 Act and our references.

Overall solid; just verify the ANZAC policy change alignment.

Would you add (or point to) a reference confirming “from 2024, no observed Monday for ANZAC Day in SA when it falls on Sunday”?

Also applies to: 559-567, 590-593, 609-621, 628-636


653-656: TAS: consistent application of move/observe windows.

  • New Year’s and Australia Day: 2001+ move on weekend — implemented.
  • Christmas/Boxing: 2000–2009 move; 2010+ observe — rules are correctly split.

LGTM.

Also applies to: 662-665, 686-691, 696-699


707-714: VIC: weekend handling matches snapshot deltas.

  • New Year’s: 1994–97 observe; 1998–2008 move; 2009+ observe — correct.
  • Australia Day: 2009+ move weekends to MON.
  • Christmas: 2008–2018 move; 2019+ observe.
  • Boxing: 1994–2007 SUN→MON move; 2008+ observe.

These changes explain the VIC snapshot corrections for 1999, 2004, 2005 precisely.

Also applies to: 720-723, 766-771, 777-782


788-791: WA: rules are in line with long-standing practice.

  • New Year’s: 1973+ observed Monday on weekends.
  • Australia Day: 1973–93 ALL→MON; 1994+ SAT/SUN→MON.
  • ANZAC: 1973+ observed.
  • Boxing/Christmas: Mon/Tue split and Monday-follow rules handled via combined ObservedRule sums.

Looks good.

Also applies to: 798-803, 813-816, 849-857, 862-865


113-148: Country-level populate: simplified and correct.

Pulling common holidays into the national branch and exiting early for subdivisions is clean and avoids duplication. Good use of group helpers (_add_new_years_day, _add_christmas_day, etc.).


54-58: Observed label set at class-level is fine.

Default observed label "%s (observed)" centralizes naming and pairs well with show_observed_label toggling to prevent duplicates.


875-907: Static special holidays retained and scoped.

Special cases (e.g., WA 2011) remain intact and are unaffected by the refactor. Good separation of static overrides.


21-27: Imported observed-rules validated

Both SAT_TO_NEXT_MON (line 55) and ALL_TO_NEXT_MON (line 71) are defined in observed_holiday_base.py and are already imported and used in multiple country modules (e.g., Montserrat, Colombia, Botswana, Bosnia and Herzegovina) as well as in australia.py itself. No further changes needed.

Comment thread holidays/countries/australia.py
Comment thread tests/countries/test_australia.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (1)
holidays/countries/australia.py (1)

510-517: Resolved: prior comment typo (“1984-1910”) fixed to “1984-2010”.

Thanks for addressing the year-range typo called out earlier.

📜 Review details

Configuration used: .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 ac72003 and 5a5eb76.

📒 Files selected for processing (1)
  • holidays/countries/australia.py (21 hunks)
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
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#2623
File: holidays/countries/christmas_island.py:110-112
Timestamp: 2025-07-09T20:27:37.760Z
Learning: In Christmas Island, ANZAC Day (April 25) follows the same observed holiday rules as other holidays, using the SAT_SUN_TO_NEXT_MON rule to move to Monday when it falls on a weekend. The implementation correctly uses `_add_observed` wrapper around `_add_anzac_day`.
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:63-70
Timestamp: 2025-03-23T10:11:50.465Z
Learning: In the holidays library, the `SAT_SUN_TO_NEXT_MON_TUE` rule is specifically used for consecutive holidays (like Christmas Day and Boxing Day) to ensure they're observed on separate weekdays (Monday and Tuesday) when they fall on weekends, while `SAT_SUN_TO_NEXT_MON` is used as the default rule for other holidays.
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.
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.
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#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.
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.
Learnt from: PPsyrius
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.
📚 Learning: 2025-07-09T20:27:37.760Z
Learnt from: KJhellico
PR: vacanza/holidays#2623
File: holidays/countries/christmas_island.py:110-112
Timestamp: 2025-07-09T20:27:37.760Z
Learning: In Christmas Island, ANZAC Day (April 25) follows the same observed holiday rules as other holidays, using the SAT_SUN_TO_NEXT_MON rule to move to Monday when it falls on a weekend. The implementation correctly uses `_add_observed` wrapper around `_add_anzac_day`.

Applied to files:

  • holidays/countries/australia.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:

  • holidays/countries/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:

  • holidays/countries/australia.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/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:

  • holidays/countries/australia.py
📚 Learning: 2025-03-23T10:11:50.465Z
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:63-70
Timestamp: 2025-03-23T10:11:50.465Z
Learning: In the holidays library, the `SAT_SUN_TO_NEXT_MON_TUE` rule is specifically used for consecutive holidays (like Christmas Day and Boxing Day) to ensure they're observed on separate weekdays (Monday and Tuesday) when they fall on weekends, while `SAT_SUN_TO_NEXT_MON` is used as the default rule for other holidays.

Applied to files:

  • holidays/countries/australia.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants like FEB, TUE, MAR, and SUN internally through parent class implementations even when these constants don't appear directly in the file.

Applied to files:

  • holidays/countries/australia.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:

  • holidays/countries/australia.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:

  • holidays/countries/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:

  • holidays/countries/australia.py
📚 Learning: 2025-07-14T20:23:48.198Z
Learnt from: KJhellico
PR: vacanza/holidays#2654
File: holidays/countries/cabo_verde.py:133-141
Timestamp: 2025-07-14T20:23:48.198Z
Learning: The holidays library provides helper methods `_add_holiday_2nd_sun_of_may()` and `_add_holiday_3rd_sun_of_jun()` for adding holidays on the 2nd Sunday of May and 3rd Sunday of June respectively. These methods are used across multiple country implementations including Latvia, Finland, Belarus, Malaysia, Madagascar, and Cape Verde.

Applied to files:

  • holidays/countries/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:

  • holidays/countries/australia.py
📚 Learning: 2025-07-08T10:20:04.069Z
Learnt from: KJhellico
PR: vacanza/holidays#2701
File: holidays/countries/palestine.py:131-131
Timestamp: 2025-07-08T10:20:04.069Z
Learning: In Palestine, both the first and second days of Christmas (Orthodox and Catholic) are holidays. The first day is a nationwide public holiday, while the second day is a holiday for the relevant religious groups (Catholic or Orthodox) with the same name. The implementation correctly uses `_add_christmas_day` for nationwide holidays and `_add_christmas_day_two` for group-specific second days.

Applied to files:

  • holidays/countries/australia.py
🧬 Code Graph Analysis (1)
holidays/countries/australia.py (3)
holidays/groups/international.py (2)
  • _add_new_years_day (142-150)
  • _add_anzac_day (43-56)
holidays/observed_holiday_base.py (2)
  • _add_observed (144-196)
  • _move_holiday (198-206)
holidays/groups/christian.py (2)
  • _add_christmas_day_two (234-242)
  • _add_christmas_day (224-232)
⏰ 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). (2)
  • GitHub Check: Test docs build
  • GitHub Check: Build distribution
🔇 Additional comments (9)
holidays/countries/australia.py (9)

21-27: Good addition: new observed-rule constants are imported and used.

SAT_TO_NEXT_MON and ALL_TO_NEXT_MON are referenced throughout; import set is accurate and minimal.


156-165: ACT refactor: rules, ordering, and labels look correct.

  • New Year’s Day: year-split and move/add semantics match comments; using show_observed_label=False on moves prevents duplicate "(observed)".
  • Australia Day: ALL_TO_NEXT_MON for pre-1990 and SAT_SUN_TO_NEXT_MON afterward is spot-on; no observed label on moves.
  • ANZAC Day: Sunday-only move is implemented correctly.
  • Boxing Day placed before Christmas Day ensures proper observed-day separation; rules match year windows.
  • Christmas Day mirrors Boxing Day handling correctly.

This should resolve duplicate "(observed)" labels for ACT.

Also applies to: 172-178, 190-198, 241-252, 254-268


289-301: NSW Australia Day flow is consistent with NSW-specific naming and rules.

  • Retaining 1946 for the "Australia Day" name (vs the national 1935 switch) looks intentional for NSW.
  • Move/add logic matches the documented year ranges.

No changes requested.


361-366: NT rules read correctly; duplication avoided.

  • Year splits for “move” vs “add” match comments across NYD, Australia Day, ANZAC, Christmas, and Boxing Day.
  • Using move with show_observed_label=False where appropriate prevents duplicate observed labeling.

Looks good.

Also applies to: 372-375, 379-384, 407-415, 420-425


444-449: QLD: logic and observed/move usage look solid.

  • NYD: pre-2012 Sunday-only move vs 2012+ add is correct.
  • Australia Day: ALL_TO_NEXT_MON pre-1996 and SAT_SUN_TO_NEXT_MON thereafter are applied correctly.
  • ANZAC Day: Sunday-only move from 1984 aligns with notes.
  • Boxing/Christmas: correct rule combos and ordering avoid label duplication.

No issues found.

Also applies to: 456-462, 467-471, 515-522, 529-534


542-549: SA: nuanced year-by-year handling is correct; labels consistent.

  • NYD and Australia Day transitions (move vs add) align with 1984/2004/2024 changes.
  • ANZAC: Sunday-only observed through 2023 matches notes.
  • Proclamation Day: split handling for 1984–1992, 1993–2002, 2003–2023, and 2024+ is implemented with the right combination of add+move and label suppression.
  • Christmas mirrors the NYD approach appropriately.

Looks right and avoids duplicate observed labels.

Also applies to: 559-567, 590-593, 609-621, 628-635


653-655: TAS: clean move/add split, correct Boxing/Christmas pairing.

  • NYD/Australia Day: 2001+ move-to-Mon logic implemented consistently with label suppression.
  • Christmas/Boxing: SAT_SUN_TO_NEXT_MON_TUE used correctly; placement ensures proper separation.

All good.

Also applies to: 662-665, 686-691, 696-699


707-714: VIC: correct application of legacy and modern rules.

  • NYD: 1994–1997 add vs 1998–2008 move vs 2009+ add handled exactly.
  • Australia Day: 2009+ move to Monday implemented with label suppression.
  • Christmas/Boxing: correct SAT/SUN-to-Mon/Tue transitions with year splits.

LGTM.

Also applies to: 720-723, 766-771, 777-782


788-791: WA: observed rules and special Monday-Tuesday handling are accurate.

  • NYD and ANZAC: adding observed days from the documented years is right.
  • Australia Day: ALL_TO_NEXT_MON pre-1994 then SAT/SUN move matches notes.
  • Boxing Day: 1972–1975 vs 1976+ rule difference (adding MON_TO_NEXT_TUE from 1976) is implemented precisely.
  • Christmas Day: add-to-Monday from 1972 aligns with comments.

No concerns.

Also applies to: 798-803, 813-816, 849-856, 862-865

Comment thread holidays/countries/australia.py
Comment thread holidays/countries/australia.py Outdated
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (1)
holidays/countries/australia.py (1)

279-284: NSW: Missing 1912+ gating for observed additions (adds observed days pre-1912).

Your comments specify “1912–2010” for observed behavior, but these blocks unconditionally call _add_observed, which will also add observed days for years < 1912. Apply guards so observed additions only start from 1912.

Apply these diffs:

New Year’s Day (Lines 279-284):

-        self._add_observed(
-            # New Year's Day.
-            self._add_new_years_day(tr("New Year's Day")),
-            rule=SAT_SUN_TO_NEXT_MON if self._year >= 2011 else SUN_TO_NEXT_MON,
-        )
+        if self._year >= 1912:
+            self._add_observed(
+                # New Year's Day.
+                self._add_new_years_day(tr("New Year's Day")),
+                rule=SAT_SUN_TO_NEXT_MON if self._year >= 2011 else SUN_TO_NEXT_MON,
+            )

Australia Day (Lines 297-301):

-            else:
-                self._add_observed(dt, rule=SUN_TO_NEXT_MON)
+            elif self._year >= 1912:
+                self._add_observed(dt, rule=SUN_TO_NEXT_MON)

Christmas Day (Lines 334-338):

-        self._add_observed(
-            # Christmas Day.
-            self._add_christmas_day(tr("Christmas Day")),
-            rule=SAT_SUN_TO_NEXT_MON_TUE if self._year >= 2011 else SUN_TO_NEXT_TUE,
-        )
+        if self._year >= 1912:
+            self._add_observed(
+                # Christmas Day.
+                self._add_christmas_day(tr("Christmas Day")),
+                rule=SAT_SUN_TO_NEXT_MON_TUE if self._year >= 2011 else SUN_TO_NEXT_TUE,
+            )

Boxing Day (Lines 344-348):

-        self._add_observed(
-            # Boxing Day.
-            self._add_christmas_day_two(tr("Boxing Day")),
-            rule=SAT_SUN_TO_NEXT_MON_TUE if self._year >= 2011 else SUN_TO_NEXT_MON,
-        )
+        if self._year >= 1912:
+            self._add_observed(
+                # Boxing Day.
+                self._add_christmas_day_two(tr("Boxing Day")),
+                rule=SAT_SUN_TO_NEXT_MON_TUE if self._year >= 2011 else SUN_TO_NEXT_MON,
+            )

Also applies to: 289-301, 334-338, 344-348

♻️ Duplicate comments (3)
holidays/countries/australia.py (3)

315-318: NSW ANZAC Day ≤2010: Correctly switched to SUN-only observed rule.

This fixes the Saturday mis-observed bug flagged earlier. Good catch.


559-567: SA: Using australia_day property — consistency improvement accepted.

This resolves the earlier nit to avoid hardcoding the name and ensures pre-1935 naming switches automatically.


510-513: QLD comments: Year-range typo corrected.

“1984–2010” is now correct across occurrences. Thanks for cleaning this up.

📜 Review details

Configuration used: .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 5a5eb76 and 4771acb.

📒 Files selected for processing (2)
  • holidays/countries/australia.py (21 hunks)
  • snapshots/countries/AU_NSW.json (0 hunks)
💤 Files with no reviewable changes (1)
  • snapshots/countries/AU_NSW.json
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: KJhellico
PR: vacanza/holidays#2623
File: holidays/countries/christmas_island.py:110-112
Timestamp: 2025-07-09T20:27:37.760Z
Learning: In Christmas Island, ANZAC Day (April 25) follows the same observed holiday rules as other holidays, using the SAT_SUN_TO_NEXT_MON rule to move to Monday when it falls on a weekend. The implementation correctly uses `_add_observed` wrapper around `_add_anzac_day`.
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:63-70
Timestamp: 2025-03-23T10:11:50.465Z
Learning: In the holidays library, the `SAT_SUN_TO_NEXT_MON_TUE` rule is specifically used for consecutive holidays (like Christmas Day and Boxing Day) to ensure they're observed on separate weekdays (Monday and Tuesday) when they fall on weekends, while `SAT_SUN_TO_NEXT_MON` is used as the default rule for other holidays.
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.
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.
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#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.
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.
Learnt from: PPsyrius
PR: vacanza/holidays#2632
File: holidays/countries/solomon_islands.py:95-98
Timestamp: 2025-06-16T12:28:31.641Z
Learning: Library-wide holiday patterns and their optimizations should be handled at the base class level (like InternationalHolidays) rather than documenting workarounds in individual country modules. This maintains separation of concerns and avoids documentation duplication.
Learnt from: PPsyrius
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.
📚 Learning: 2025-07-09T20:27:37.760Z
Learnt from: KJhellico
PR: vacanza/holidays#2623
File: holidays/countries/christmas_island.py:110-112
Timestamp: 2025-07-09T20:27:37.760Z
Learning: In Christmas Island, ANZAC Day (April 25) follows the same observed holiday rules as other holidays, using the SAT_SUN_TO_NEXT_MON rule to move to Monday when it falls on a weekend. The implementation correctly uses `_add_observed` wrapper around `_add_anzac_day`.

Applied to files:

  • holidays/countries/australia.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:

  • holidays/countries/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:

  • holidays/countries/australia.py
📚 Learning: 2025-03-23T10:11:50.465Z
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:63-70
Timestamp: 2025-03-23T10:11:50.465Z
Learning: In the holidays library, the `SAT_SUN_TO_NEXT_MON_TUE` rule is specifically used for consecutive holidays (like Christmas Day and Boxing Day) to ensure they're observed on separate weekdays (Monday and Tuesday) when they fall on weekends, while `SAT_SUN_TO_NEXT_MON` is used as the default rule for other holidays.

Applied to files:

  • holidays/countries/australia.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/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:

  • holidays/countries/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:

  • holidays/countries/australia.py
📚 Learning: 2025-04-03T16:58:27.175Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants like FEB, TUE, MAR, and SUN internally through parent class implementations even when these constants don't appear directly in the file.

Applied to files:

  • holidays/countries/australia.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:

  • holidays/countries/australia.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:

  • holidays/countries/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:

  • holidays/countries/australia.py
📚 Learning: 2025-07-14T20:23:48.198Z
Learnt from: KJhellico
PR: vacanza/holidays#2654
File: holidays/countries/cabo_verde.py:133-141
Timestamp: 2025-07-14T20:23:48.198Z
Learning: The holidays library provides helper methods `_add_holiday_2nd_sun_of_may()` and `_add_holiday_3rd_sun_of_jun()` for adding holidays on the 2nd Sunday of May and 3rd Sunday of June respectively. These methods are used across multiple country implementations including Latvia, Finland, Belarus, Malaysia, Madagascar, and Cape Verde.

Applied to files:

  • holidays/countries/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:

  • holidays/countries/australia.py
📚 Learning: 2025-07-08T10:20:04.069Z
Learnt from: KJhellico
PR: vacanza/holidays#2701
File: holidays/countries/palestine.py:131-131
Timestamp: 2025-07-08T10:20:04.069Z
Learning: In Palestine, both the first and second days of Christmas (Orthodox and Catholic) are holidays. The first day is a nationwide public holiday, while the second day is a holiday for the relevant religious groups (Catholic or Orthodox) with the same name. The implementation correctly uses `_add_christmas_day` for nationwide holidays and `_add_christmas_day_two` for group-specific second days.

Applied to files:

  • holidays/countries/australia.py
🧬 Code Graph Analysis (1)
holidays/countries/australia.py (3)
holidays/groups/international.py (2)
  • _add_new_years_day (142-150)
  • _add_anzac_day (43-56)
holidays/observed_holiday_base.py (2)
  • _add_observed (144-196)
  • _move_holiday (198-206)
holidays/groups/christian.py (2)
  • _add_christmas_day_two (234-242)
  • _add_christmas_day (224-232)
⏰ 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). (2)
  • GitHub Check: Test docs build
  • GitHub Check: Build distribution
🔇 Additional comments (4)
holidays/countries/australia.py (4)

21-27: Imports for new observed rules look correct and needed.

Adding SAT_TO_NEXT_MON and ALL_TO_NEXT_MON aligns with the refactor and their usages below.


608-621: SA Proclamation Day: Mixed add+move flow avoids duplicate labels.

The sequence “add observed for SUN/MON-to-TUE” then move SAT-to-MON (with show_observed_label=False) is precise and prevents duplicate “(observed)” labels while maintaining historical behavior.


156-164: ACT New Year’s Day: dt-first + rule-driven move/observe is spot on.

2015+ uses add_observed; 1959–2014 uses move with the correct 1993 split. Matches the stated policy and avoids label duplication.


241-268: ACT Christmas/Boxing sequencing correct and label-safe.

Processing Boxing Day before Christmas and using SAT_SUN_TO_NEXT_MON_TUE (+ MON_TO_NEXT_TUE where needed) is the right pattern to keep days separated and labels clean.

Comment thread holidays/countries/australia.py

@PPsyrius PPsyrius left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 🇦🇺

Nice refactoring

@arkid15r arkid15r left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good stuff for 🇦🇺

@arkid15r arkid15r added this pull request to the merge queue Aug 19, 2025
Merged via the queue into vacanza:dev with commit acd64c1 Aug 19, 2025
36 checks passed
@KJhellico KJhellico deleted the ref-australia branch August 19, 2025 19:08
@arkid15r arkid15r mentioned this pull request Sep 1, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Sep 19, 2025
24 tasks
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.

Fix duplicate observed label for AU

3 participants