Skip to content

Conversation

@LuccaAug
Copy link
Contributor

@LuccaAug LuccaAug commented Apr 7, 2025

Proposed change

Add French Southern Territories holidays.
Resolves #2434.

Type of change

  • New country/market holidays support (thank you!)

Checklist

  • I've followed the [contributing guidelines][contributing-guidelines]
  • I've successfully run make check, all checks and tests are green

Copilot AI review requested due to automatic review settings April 7, 2025 16:39
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 7, 2025

Summary by CodeRabbit

  • New Features

    • Added support for French Southern Territories holidays, including aliases and relevant country codes.
    • Introduced English, French, and Ukrainian localization files for French Southern Territories holidays.
  • Documentation

    • Updated documentation to reflect support for the French Southern Territories and increased the total number of supported country codes.
  • Tests

    • Added tests to verify holiday dates and country aliasing for the French Southern Territories.

Summary by CodeRabbit

  • New Features

    • Expanded holiday support by adding the French Southern Territories, increasing the number of supported country codes to 169.
    • Holiday calculations now include this region with holiday names localized in English (US), French, and Ukrainian.
  • Documentation

    • Updated documentation to reflect the expanded list of supported regions.
    • Credited a new contributor for their work on the update.

Walkthrough

This pull request introduces support for the French Southern Territories in the library. It includes the addition of a new author in AUTHORS.md, an update in README.md to reflect an increase in supported country codes, and a new module for holiday logic specific to the French Southern Territories. Localization files for English, French, and Ukrainian are also added, along with an update to the registry and a comprehensive set of unit tests to validate the new functionality.

Changes

File(s) Change Summary
AUTHORS.md Added new author "Lucca Augusto".
README.md Increased supported country codes from 168 to 169 and added an entry for French Southern Territories with code TF and languages en_US, fr, uk.
holidays/countries/__init__.py Added import for French Southern Territories: from .french_southern_territories import FrenchSouthernTerritories, TF, ATF, HolidaysTF.
holidays/countries/french_southern_territories.py Introduced a new module defining the HolidaysTF, FrenchSouthernTerritories, TF, and ATF classes for holiday calculations.
holidays/locale/en_US/LC_MESSAGES/TF.po, holidays/locale/fr/LC_MESSAGES/TF.po, holidays/locale/uk/LC_MESSAGES/TF.po Added new localization files for English, French, and Ukrainian with metadata for holiday names related to French Southern Territories.
holidays/registry.py Added new registry entry "french_southern_territories": ("FrenchSouthernTerritories", "TF", "ATF", "HolidaysTF") to the COUNTRIES dictionary.
tests/countries/test_french_southern_territories.py Added a new test file with unit tests covering holiday logic, aliases, and localization for French Southern Territories.
holidays/countries/france.py Updated type hint for subdivisions attribute in France class to tuple[str, ...].

Assessment against linked issues

Objective Addressed Explanation
Add holiday support for French Southern Territories (#2434)

Suggested reviewers

  • KJhellico
  • PPsyrius

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 133085e and 5877deb.

📒 Files selected for processing (1)
  • holidays/countries/france.py (1 hunks)
🔇 Additional comments (1)
holidays/countries/france.py (1)

34-34: Good addition of type annotation.

Adding the tuple[str, ...] type annotation for the subdivisions attribute improves code clarity and enables better static type checking. This change helps maintain code quality without modifying behavior and properly supports the inheritance pattern needed for the French Southern Territories implementation.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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.

Documentation and Community

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.

Files not reviewed (2)
  • holidays/locale/en_US/LC_MESSAGES/TF.po: Language not supported
  • holidays/locale/fr/LC_MESSAGES/TF.po: Language not supported

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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d193ff and 13d503f.

📒 Files selected for processing (8)
  • AUTHORS.md (1 hunks)
  • README.md (2 hunks)
  • holidays/countries/__init__.py (1 hunks)
  • holidays/countries/french_southern_territories.py (1 hunks)
  • holidays/locale/en_US/LC_MESSAGES/TF.po (1 hunks)
  • holidays/locale/fr/LC_MESSAGES/TF.po (1 hunks)
  • holidays/registry.py (1 hunks)
  • tests/countries/test_french_southern_territories.py (1 hunks)
🧰 Additional context used
🧬 Code Definitions (3)
holidays/countries/__init__.py (1)
holidays/countries/french_southern_territories.py (3)
  • FrenchSouthernTerritories (20-84)
  • TF (87-88)
  • ATF (91-92)
tests/countries/test_french_southern_territories.py (2)
tests/common.py (7)
  • TestCase (28-338)
  • assertNoHoliday (244-246)
  • assertHolidayDates (170-172)
  • assertHoliday (150-152)
  • assertNoHolidayName (273-275)
  • assertHolidayName (195-199)
  • assertLocalizedHolidays (327-338)
holidays/countries/french_southern_territories.py (3)
  • FrenchSouthernTerritories (20-84)
  • TF (87-88)
  • ATF (91-92)
holidays/countries/french_southern_territories.py (4)
holidays/countries/france.py (1)
  • France (19-236)
holidays/groups/christian.py (7)
  • ChristianHolidays (22-463)
  • _add_easter_monday (259-268)
  • _add_whit_monday (432-441)
  • _add_ascension_thursday (119-127)
  • _add_assumption_of_mary_day (148-164)
  • _add_all_saints_day (97-105)
  • _add_christmas_day (208-216)
holidays/groups/international.py (4)
  • InternationalHolidays (18-220)
  • _add_new_years_day (126-134)
  • _add_labor_day (99-108)
  • _add_world_war_two_victory_day (199-210)
holidays/observed_holiday_base.py (1)
  • ObservedHolidayBase (101-239)
🔇 Additional comments (19)
AUTHORS.md (1)

86-86: Welcome to the project!

The addition of your name to the AUTHORS.md file is correctly formatted and placed alphabetically in the list.

README.md (2)

102-102: Country count updated correctly

The count has been properly incremented from 165 to 166 to reflect the addition of the French Southern Territories.


529-534: French Southern Territories entry added properly

The entry is correctly formatted and includes all necessary information (country name, code, and supported languages). The entry is also placed in the correct alphabetical position.

holidays/countries/__init__.py (1)

70-70: Import statement added properly

The import for the French Southern Territories module is correctly placed in alphabetical order and includes all necessary classes and constants.

holidays/registry.py (1)

79-79: Registry entry added properly

The entry for French Southern Territories in the COUNTRIES dictionary follows the correct format and is alphabetically positioned between "france" and "gabon".

holidays/locale/en_US/LC_MESSAGES/TF.po (2)

15-29: The metadata and header information looks correct.

The file contains all the necessary metadata for the localization file including project version, creation date, translator information, and language specifications.


30-77: Holiday translations look complete and accurate.

All the holiday translations from French to English are appropriate and cover the full range of holidays implemented in the French Southern Territories class.

holidays/locale/fr/LC_MESSAGES/TF.po (1)

30-76: Empty msgstr fields are correct for French localization.

Since the original holiday names (msgid) are already in French, leaving the translated strings (msgstr) empty is the correct approach for a French localization file.

holidays/countries/french_southern_territories.py (5)

13-18: Module imports look appropriate and comprehensive.

The imports include all necessary components: gettext for translation, France as the parent class, and required holiday group classes.


20-32: Class definition and attributes are properly structured.

The class inherits from appropriate base classes and correctly defines country code, parent entity relationship, language support, and start year. The comment on line 31 explaining the reasoning for using France's start year is helpful.


34-38: Constructor implementation is correct.

The constructor properly initializes parent classes in the appropriate order, ensuring the inheritance chain works correctly.


39-84: Holiday population method follows the expected pattern.

The _populate_public_holidays method correctly implements holiday definitions following the same pattern and year-based conditions as the France class, which is appropriate since these are French territories.


87-93: Empty alias classes look correct.

The TF and ATF alias classes are properly defined. These empty classes inheriting from the main class follow the pattern used elsewhere in the codebase.

tests/countries/test_french_southern_territories.py (6)

13-17: Appropriate imports for the test class.

The test file imports the necessary components: TestCase from unittest, all relevant classes from the french_southern_territories module, and CommonCountryTests base class.


19-26: Test class setup is correctly implemented.

The TestTF class properly extends from CommonCountryTests and TestCase. The setUpClass method initializes with appropriate parameters, and the test_country_aliases method verifies the alias classes.


27-29: Pre-1802 tests verify correct historical behavior.

The test correctly verifies that religious holidays (Assumption, All Saints, Christmas) are not observed before 1802, which matches the implementation in the French Southern Territories class.


30-60: Year-specific holiday tests are comprehensive.

Tests for 2017 and 2022 verify that all expected holidays are present on the correct dates, providing good coverage of the holiday calculation logic.


62-104: Individual holiday tests verify correct year ranges.

Tests for specific holidays (New Year's Day, Labor Day, Victory Day, National Day, Armistice Day, Pentecost Monday) properly verify both the existence of holidays in expected years and their absence in years before they were established.


105-134: Localization tests verify correct translations.

The tests for default (French) and English (en_US) localization verify that all holiday names are correctly translated in both languages, ensuring the localization files are properly integrated.

LuccaAug and others added 3 commits April 7, 2025 13:45
Copy link
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/countries/test_french_southern_territories.py (1)

80-80: Previous issue has been addressed correctly.

This line correctly implements the suggested fix from the previous review by using a list comprehension with proper unpacking.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 13d503f and cff7986.

📒 Files selected for processing (1)
  • tests/countries/test_french_southern_territories.py (1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
tests/countries/test_french_southern_territories.py (2)
tests/common.py (7)
  • TestCase (28-338)
  • assertAliases (121-130)
  • assertNoHoliday (244-246)
  • assertHolidayDates (170-172)
  • assertHoliday (150-152)
  • assertNoHolidayName (273-275)
  • assertLocalizedHolidays (327-338)
holidays/countries/french_southern_territories.py (3)
  • FrenchSouthernTerritories (20-84)
  • TF (87-88)
  • ATF (91-92)
🔇 Additional comments (2)
tests/countries/test_french_southern_territories.py (2)

1-134: Test coverage looks comprehensive and well-structured.

The test file provides thorough coverage for the new FrenchSouthernTerritories holiday class. It effectively tests historical introduction dates, name changes, specific years, and proper localization for both French and English.


97-104: Good test for Pentecost Monday exceptions.

This test properly verifies that Pentecost Monday wasn't observed during 2005-2007 but was observed in surrounding years. This matches the implementation in the FrenchSouthernTerritories class.

@codecov
Copy link

codecov bot commented Apr 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (f189cce) to head (5877deb).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #2442   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          213       214    +1     
  Lines        13510     13527   +17     
  Branches      1928      1928           
=========================================
+ Hits         13510     13527   +17     

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

@KJhellico
Copy link
Collaborator

Since it's an overseas territory of France, it should be implemented similar to the US dependent territories (Guam, Puerto Rico, etc.). For localization, the approach is similar to Isle of Man.

@KJhellico KJhellico changed the title Adds French Southern Territories Add French Southern Territories holidays Apr 7, 2025
@LuccaAug LuccaAug changed the title Add French Southern Territories holidays Adds French Southern Territories holidays Apr 7, 2025
@LuccaAug LuccaAug changed the title Adds French Southern Territories holidays Add French Southern Territories holidays Apr 7, 2025
This was referenced May 23, 2025
@coderabbitai coderabbitai bot mentioned this pull request Aug 23, 2025
9 tasks
@coderabbitai coderabbitai bot mentioned this pull request Sep 26, 2025
9 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.

Add French Southern Territories holidays

4 participants