Skip to content

Conversation

@KJhellico
Copy link
Collaborator

@KJhellico KJhellico commented Feb 15, 2025

Proposed change

Update IslamicHolidays: add an option whether to add estimation label to holiday name.
I believe that this feature is useful not only for testing, but also for real use.

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

@codecov
Copy link

codecov bot commented Feb 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (b53772f) to head (4985dda).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #2298   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          204       204           
  Lines        12560     12562    +2     
  Branches      1797      1797           
=========================================
+ Hits         12560     12562    +2     

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

PPsyrius
PPsyrius previously approved these changes Feb 17, 2025
Copy link
Collaborator

@PPsyrius PPsyrius left a comment

Choose a reason for hiding this comment

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

LGTM ☪️

@KJhellico KJhellico marked this pull request as draft February 17, 2025 22:44
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.

The structure looks good. A couple of points to address:

  • this needs to be documented somehow (it's a dangling param at the moment) with a clear indication that the dates are still estimated but the names just don't contain that label
  • maybe let's add a def test_yyyy_no_estimated_label(self): test for better functionality representation in the tests?

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 3, 2025

Summary by CodeRabbit

  • New Features

    • Introduced an optional setting to control whether “estimated” labels are displayed for Islamic holiday dates, providing users with greater flexibility in holiday presentation across supported regions.
  • Tests

    • Updated test suites to validate holiday representations both when the estimated labels are enabled and when they are suppressed.

Walkthrough

The modifications update various holiday classes to support an optional display of estimated Islamic holiday dates. Each class now accepts an additional parameter, islamic_show_estimated, which defaults to True, allowing users to specify whether an "estimated" label should be included for Islamic holidays. Corresponding changes are made to the IslamicHolidays superclass to accommodate this new parameter. Additionally, tests are revised to instantiate holiday objects without estimated labels and to verify that holiday names reflect these settings accurately.

Changes

File(s) Change Summary
holidays/countries/pakistan.py
holidays/groups/islamic.py
Updated constructors to include new parameters for estimated holiday labeling. The Pakistan class now accepts an islamic_show_estimated parameter (defaulting to True) and passes it to the IslamicHolidays superclass. Similarly, the IslamicHolidays class now accepts a show_estimated parameter and stores it for use in holiday addition methods.
holidays/countries/afghanistan.py
holidays/countries/albania.py
holidays/countries/algeria.py
holidays/countries/azerbaijan.py
holidays/countries/bahrain.py
holidays/countries/bosnia_and_herzegovina.py
holidays/countries/brunei.py
holidays/countries/burkina_faso.py
holidays/countries/burundi.py
holidays/countries/cameroon.py
holidays/countries/chad.py
holidays/countries/djibouti.py
holidays/countries/egypt.py
holidays/countries/ethiopia.py
holidays/countries/gabon.py
holidays/countries/ghana.py
holidays/countries/india.py
holidays/countries/indonesia.py
holidays/countries/iran.py
holidays/countries/jordan.py
holidays/countries/kazakhstan.py
holidays/countries/kenya.py
holidays/countries/kuwait.py
holidays/countries/kyrgyzstan.py
holidays/countries/malaysia.py
holidays/countries/maldives.py
holidays/countries/mauritania.py
holidays/countries/montenegro.py
holidays/countries/morocco.py
holidays/countries/nigeria.py
holidays/countries/north_macedonia.py
holidays/countries/philippines.py
holidays/countries/saudi_arabia.py
holidays/countries/singapore.py
holidays/countries/spain.py
holidays/countries/sri_lanka.py
holidays/countries/tanzania.py
holidays/countries/timor_leste.py
holidays/countries/tunisia.py
holidays/countries/turkey.py
holidays/countries/united_arab_emirates.py
holidays/countries/uzbekistan.py
Each of these classes has been updated to include the islamic_show_estimated parameter in their constructors, allowing for control over the display of estimated labels for Islamic holidays. The initialization of the IslamicHolidays superclass has been adjusted to accommodate this new parameter.
tests/countries/test_afghanistan.py
tests/countries/test_albania.py
tests/countries/test_indonesia.py
tests/countries/test_kenya.py
tests/countries/test_philippines.py
tests/countries/test_united_arab_emirates.py
Introduced a new test variable no_estimated_holidays configured with islamic_show_estimated=False. Adjusted assertions for holiday names to utilize this variable, simplifying the tests by directly checking holiday names against the new instances without estimated labels.

Possibly related PRs

Suggested labels

snapshot

Suggested reviewers

  • arkid15r

📜 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 b34d05d and 4985dda.

📒 Files selected for processing (5)
  • holidays/countries/indonesia.py (1 hunks)
  • holidays/countries/philippines.py (1 hunks)
  • holidays/countries/timor_leste.py (1 hunks)
  • tests/countries/test_indonesia.py (10 hunks)
  • tests/countries/test_philippines.py (3 hunks)
⏰ Context from checks skipped due to timeout of 300000ms (1)
  • GitHub Check: Test build on windows-latest
🔇 Additional comments (19)
holidays/countries/timor_leste.py (2)

55-59: Implementation looks good and follows best practices.

The addition of the islamic_show_estimated parameter with proper type annotation and default value provides users with control over the display of estimated labels for Islamic holidays. The docstring clearly explains the parameter's purpose.


62-64: Well-implemented parameter passing to the parent class.

The show_estimated parameter is correctly passed to the IslamicHolidays constructor, ensuring that the user's preference propagates to the implementation that handles Islamic holidays.

tests/countries/test_philippines.py (3)

24-26: Good addition of the non-estimated holidays instance.

The addition of no_estimated_holidays instance creates a clean way to test holidays without the estimated label, which is essential for verifying the new feature.


285-286: Clear test logic for Eid al-Fitr without estimation labels.

The test now properly verifies the holiday name both with and without the estimated label, which helps ensure the feature works correctly across different year ranges.


303-304: Similar clear test logic for Eid al-Adha.

The test implementation is consistent with the Eid al-Fitr test, showing proper test patterns across similar features.

holidays/countries/indonesia.py (2)

65-69: Good implementation with clear parameter documentation.

The added parameter islamic_show_estimated with a default of True maintains backward compatibility while adding new functionality. The docstring clearly explains the parameter's purpose.


75-77: Correctly passing the parameter to the parent class.

The implementation correctly passes the islamic_show_estimated parameter to the IslamicHolidays superclass, ensuring the functionality is properly connected.

holidays/countries/philippines.py (2)

64-68: Well-structured parameter addition with clear documentation.

The implementation adds the islamic_show_estimated parameter with an appropriate default value of True to maintain backward compatibility. The docstring clearly explains the parameter's purpose.


72-74: Proper parameter passing to the parent class.

The implementation correctly passes the islamic_show_estimated parameter to the IslamicHolidays superclass initialization, ensuring the feature works as intended.

tests/countries/test_indonesia.py (10)

24-26: Good addition of the non-estimated holidays instance.

The addition of the no_estimated_holidays instance creates a consistent way to test holidays without the estimated label, supporting the new feature verification.


308-310: Streamlined test code with unpacking operator.

The test now uses a more concise syntax by combining ranges with the unpacking operator, improving code readability.


371-373: Simplified test for independence day.

The code is more concise by directly passing the holiday name string rather than first assigning it to a variable.


405-406: Clear test logic for Eid al-Fitr without estimation labels.

The test effectively verifies the holiday name without the estimated label, helping ensure the feature works correctly across different years.


419-420: Consistent test pattern for the second day of Eid al-Fitr.

The test maintains consistency with the first day test pattern, demonstrating good test organization.


433-434: Properly tests Eid al-Adha without estimation labels.

The test follows the established pattern for testing holidays without the estimated label.


449-454: Clear test logic for Islamic New Year without estimation labels.

The test effectively handles multiple date ranges while verifying the holiday name without the estimated label.


466-471: Properly tests Prophet's Birthday without estimation labels.

The test maintains the same pattern as other Islamic holidays, showing consistency across the test suite.


484-489: Consistent test pattern for Isra and Mi'raj.

The test continues to follow the established pattern, maintaining consistency throughout the test suite.


505-508: Properly tests Nuzul Al Quran without estimation labels.

The test correctly implements the verification of the holiday name without the estimated label.

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

@KJhellico KJhellico changed the title [PoC] Update IslamicHolidays: add an option whether to add estimation label to holiday name Update IslamicHolidays: add an option whether to add estimation label to holiday name Mar 3, 2025
@KJhellico KJhellico marked this pull request as ready for review March 3, 2025 21:37
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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d0b6815 and b34d05d.

📒 Files selected for processing (48)
  • holidays/countries/afghanistan.py (1 hunks)
  • holidays/countries/albania.py (1 hunks)
  • holidays/countries/algeria.py (1 hunks)
  • holidays/countries/azerbaijan.py (1 hunks)
  • holidays/countries/bahrain.py (1 hunks)
  • holidays/countries/bosnia_and_herzegovina.py (1 hunks)
  • holidays/countries/brunei.py (1 hunks)
  • holidays/countries/burkina_faso.py (1 hunks)
  • holidays/countries/burundi.py (1 hunks)
  • holidays/countries/cameroon.py (1 hunks)
  • holidays/countries/chad.py (1 hunks)
  • holidays/countries/djibouti.py (1 hunks)
  • holidays/countries/egypt.py (1 hunks)
  • holidays/countries/ethiopia.py (1 hunks)
  • holidays/countries/gabon.py (1 hunks)
  • holidays/countries/ghana.py (1 hunks)
  • holidays/countries/india.py (1 hunks)
  • holidays/countries/indonesia.py (1 hunks)
  • holidays/countries/iran.py (1 hunks)
  • holidays/countries/jordan.py (1 hunks)
  • holidays/countries/kazakhstan.py (1 hunks)
  • holidays/countries/kenya.py (1 hunks)
  • holidays/countries/kuwait.py (1 hunks)
  • holidays/countries/kyrgyzstan.py (1 hunks)
  • holidays/countries/malaysia.py (3 hunks)
  • holidays/countries/maldives.py (1 hunks)
  • holidays/countries/mauritania.py (1 hunks)
  • holidays/countries/montenegro.py (1 hunks)
  • holidays/countries/morocco.py (1 hunks)
  • holidays/countries/nigeria.py (1 hunks)
  • holidays/countries/north_macedonia.py (1 hunks)
  • holidays/countries/philippines.py (1 hunks)
  • holidays/countries/saudi_arabia.py (1 hunks)
  • holidays/countries/singapore.py (2 hunks)
  • holidays/countries/spain.py (1 hunks)
  • holidays/countries/sri_lanka.py (1 hunks)
  • holidays/countries/tanzania.py (1 hunks)
  • holidays/countries/timor_leste.py (1 hunks)
  • holidays/countries/tunisia.py (1 hunks)
  • holidays/countries/turkey.py (1 hunks)
  • holidays/countries/united_arab_emirates.py (1 hunks)
  • holidays/countries/uzbekistan.py (1 hunks)
  • tests/countries/test_afghanistan.py (8 hunks)
  • tests/countries/test_albania.py (3 hunks)
  • tests/countries/test_indonesia.py (10 hunks)
  • tests/countries/test_kenya.py (2 hunks)
  • tests/countries/test_philippines.py (3 hunks)
  • tests/countries/test_united_arab_emirates.py (5 hunks)
🔇 Additional comments (93)
tests/countries/test_kenya.py (2)

207-209: Appropriate update for testing without estimated labels.

The test now properly creates a Kenya instance with islamic_show_estimated=False to test the holiday names without the "estimated" label.


257-261: Well-structured test for Islamic holidays without estimation label.

This test case correctly verifies that the Islamic holiday name is displayed without the "estimated" label when the islamic_show_estimated parameter is set to False.

holidays/countries/jordan.py (1)

33-40: Clean implementation of the show_estimated parameter.

The parameter is well-documented with a proper type hint and default value that maintains backward compatibility. The initialization of the parent class correctly passes the parameter.

holidays/countries/spain.py (1)

81-90: Good implementation of the show_estimated option.

The parameter is properly added with documentation and type hints. The initialization of IslamicHolidays passes the parameter correctly while maintaining the custom class parameter.

holidays/countries/djibouti.py (1)

30-37: Well-implemented parameter addition.

The implementation follows the same pattern as other country classes, maintaining consistency across the codebase. The parameter is correctly documented and passed to the parent class.

tests/countries/test_albania.py (3)

23-23: Good addition of the no_estimated_holidays instance.

This creates a test instance of Albania holidays with Islamic estimated labels turned off, which supports testing both display modes.


129-129: Clean implementation of testing without estimated labels.

The test now properly uses the no_estimated_holidays instance to verify holiday names appear correctly without estimated labels.


147-147: Consistent approach for testing Eid al-Adha without estimated labels.

Using the same pattern as the Eid al-Fitr test maintains consistency in the test approach.

holidays/countries/azerbaijan.py (2)

47-51: Well-structured parameter addition with good documentation.

The parameter is clearly named, has a sensible default value, and includes proper type annotation. The docstring explains the parameter's purpose effectively.


53-55: Correct implementation of the parameter passing.

The parameter is properly passed to the IslamicHolidays superclass, maintaining the connection between the user-facing option and the internal implementation.

tests/countries/test_philippines.py (3)

24-26: Good creation of Philippines test instance without estimated labels.

Consistent with the pattern used in other test files, providing proper test coverage for the new feature.


283-284: Clean replacement of the previous testing approach.

The test now properly verifies holiday names without estimated labels for Eid al-Fitr across the defined year ranges.


300-301: Consistent approach for testing Eid al-Adha without estimated labels.

The same pattern is properly applied to the Eid al-Adha test, ensuring both Islamic holidays are tested consistently.

holidays/countries/ghana.py (2)

33-37: Good parameter addition with clear documentation.

The islamic_show_estimated parameter is properly added with type annotation and default value. The docstring clearly explains its purpose.


40-40: Correct implementation of parameter passing to IslamicHolidays.

The parameter is properly forwarded to the IslamicHolidays superclass initialization.

holidays/countries/cameroon.py (2)

39-43: Clean implementation of the new parameter

The parameter is well-documented and has a clear purpose.


46-48: Proper implementation of the parent class initialization

Good job passing the new parameter to the IslamicHolidays initialization.

holidays/countries/chad.py (2)

38-42: Well-structured parameter documentation

The parameter documentation clearly explains the purpose of the option.


45-47: Consistent implementation across classes

The parameter is passed correctly to the parent class, maintaining consistency with other country implementations.

holidays/countries/gabon.py (2)

32-36: Clear parameter documentation

The parameter documentation is clear and consistent with other implementations.


39-41: Proper parameter passing to parent class

Good implementation of passing the parameter to the IslamicHolidays initialization.

holidays/countries/philippines.py (3)

63-67: Consistent parameter implementation

The parameter is well-documented and matches the implementation in other country classes.


71-73: Correct parent class initialization

The parameter is correctly passed to the IslamicHolidays initialization.


59-60:

❓ Verification inconclusive

Verify this estimated_label is used by IslamicHolidays

The class already has an estimated_label property. Make sure the IslamicHolidays class uses this property when show_estimated is True.


🏁 Script executed:

#!/bin/bash
# Search for where the estimated_label is used in IslamicHolidays
rg -A 15 'estimated_label' --glob '*.py' | grep -B 5 -A 15 'class IslamicHolidays'

Length of output: 82


Manual Verification Required: Confirm estimated_label Usage in IslamicHolidays

It appears that our automated search didn’t uncover any usage of the estimated_label property within the IslamicHolidays class. Please manually verify that when show_estimated is True, the class indeed applies the estimated_label value as intended.

  • Location: holidays/countries/philippines.py (lines 59-60) defines the estimated_label.
  • Action: Confirm that within the definition or methods of the IslamicHolidays class, the estimated_label property is used correctly when show_estimated is True.
  • Suggestion: If it isn’t currently being used, update the IslamicHolidays implementation accordingly.
holidays/countries/burundi.py (1)

33-40: Consistent implementation of the new parameter

The added parameter islamic_show_estimated with proper typing and default value follows good practices. The docstring clearly explains the parameter's purpose.

holidays/countries/saudi_arabia.py (1)

54-59: Good parameter implementation with clear documentation

The addition of the islamic_show_estimated parameter with proper typing and documentation aligns with the PR objectives to enhance flexibility for Islamic holiday representations.

holidays/countries/united_arab_emirates.py (1)

65-73: Properly implemented parameter with clear documentation

The addition of the islamic_show_estimated parameter with default value and docstring is consistent with other country implementations. I appreciate the multi-line call to IslamicHolidays.__init__() which keeps the code readable even with multiple parameters.

holidays/countries/indonesia.py (1)

65-76: Clean implementation of the configurable estimated label feature

The addition of the islamic_show_estimated parameter with proper documentation is consistent with the other country implementations. The parameter is correctly passed to the IslamicHolidays constructor.

holidays/countries/bosnia_and_herzegovina.py (1)

76-85: Consistent implementation of the estimation label feature

The parameter addition for controlling the display of the estimated label is well-implemented. The type hinting, default value, and docstring provide clear guidance on the parameter's purpose.

holidays/countries/maldives.py (1)

29-35: Parameter implementation looks good

The addition of the islamic_show_estimated parameter with its default value and docstring is appropriately implemented. This matches the pattern seen in other country classes.

holidays/countries/burkina_faso.py (1)

31-40: Clear and consistent parameter implementation

The implementation of the islamic_show_estimated parameter is well-structured with proper documentation. The parameter is correctly passed to the IslamicHolidays initialization with the custom class.

holidays/countries/albania.py (1)

49-58: Properly implemented parameter control

The parameter addition follows the same pattern as other country classes. The implementation provides users flexibility in controlling Islamic holiday display labels without affecting other functionality.

holidays/countries/afghanistan.py (1)

51-59: Consistent parameter implementation enhances user control over holiday naming.

The addition of the islamic_show_estimated parameter with a default value of True provides good flexibility for controlling how Islamic holidays with estimated dates are displayed.

holidays/countries/nigeria.py (1)

34-41: Parameter implementation is consistent with other country classes.

The implementation properly allows users to control whether estimated labels appear on Islamic holidays, maintaining consistency with the pattern established in other country classes.

holidays/countries/iran.py (1)

53-60: Implementation maintains consistency with other country classes.

The changes here correctly implement the new parameter while preserving the existing class-specific customization through the cls parameter.

holidays/countries/north_macedonia.py (1)

25-33: Clean implementation follows established pattern.

The parameter addition and docstring follow the same pattern as the other country classes, ensuring a consistent API throughout the codebase.

holidays/countries/mauritania.py (2)

28-34: Good implementation of the estimation labeling option.

The code adds a well-documented parameter islamic_show_estimated that allows users to control whether Islamic holidays are marked as estimated.


34-34: Clean implementation passing the parameter to IslamicHolidays.

The parameter is properly forwarded to the IslamicHolidays constructor, ensuring the feature works correctly.

holidays/countries/kuwait.py (2)

34-40: Good implementation of the Islamic holiday estimation label option.

The parameter addition is consistent with the PR objectives and follows the same pattern as other country implementations.


40-40: Properly passes the parameter to IslamicHolidays.

The parameter is correctly forwarded as show_estimated to the IslamicHolidays constructor.

holidays/countries/turkey.py (1)

41-49: Good implementation of the estimation labeling option with TurkeyIslamicHolidays.

The new parameter is added while preserving the custom Islamic holidays class. The multiline call format improves readability.

holidays/countries/tanzania.py (1)

70-79: Good implementation of the Islamic holiday estimation label option.

The new parameter is properly documented and passed correctly to IslamicHolidays along with the custom Tanzania implementation.

holidays/countries/sri_lanka.py (1)

90-100: Implementation of islamic_show_estimated parameter looks good.

Clear parameter documentation and correct implementation in the IslamicHolidays initialization. This addition gives users control over the display of estimated labels for Islamic holidays.

holidays/countries/morocco.py (1)

34-40: Parameter implementation is consistent with design pattern.

The islamic_show_estimated parameter is well-documented and correctly passed to the IslamicHolidays initialization, maintaining consistency with other country classes.

holidays/countries/tunisia.py (1)

28-35: Good implementation of the optional estimation label feature.

The parameter is properly documented and correctly passed to the IslamicHolidays class. This enhances the flexibility of Islamic holiday representations.

holidays/countries/algeria.py (1)

36-43: Implementation matches other country classes.

The islamic_show_estimated parameter follows the same pattern used throughout the codebase. Documentation is clear and the parameter is correctly passed to IslamicHolidays.

holidays/countries/kyrgyzstan.py (1)

28-35: Feature implementation looks correct and complete.

The changes correctly implement the ability to control whether estimated labels are shown for Islamic holidays. The parameter is well-documented with proper type annotation.

holidays/countries/singapore.py (2)

50-54: Implementation is consistent with project patterns.

The new parameter is properly typed and documented, matching the implementation across other country classes.


92-94: Good restructuring for improved readability.

The multi-line format for the IslamicHolidays init call improves code readability while adding the new parameter.

holidays/countries/bahrain.py (1)

37-45: Feature implementation is correct and improves flexibility.

The changes effectively implement the option to control showing estimated labels for Islamic holidays. Both the parameter addition and multi-line formatting improve code quality.

holidays/countries/timor_leste.py (1)

54-63: Implementation matches other country classes perfectly.

The changes follow the same pattern as other country classes, showing consistent implementation across the codebase. The parameter is properly typed and documented, and the multi-line formatting improves readability.

holidays/countries/montenegro.py (2)

56-60: Clear and well-documented parameter addition

The new parameter islamic_show_estimated is clearly defined with a sensible default value and well documented. This enhances the API usability.


64-66: Parameter correctly passed to superclass

Good implementation of passing the new parameter to the IslamicHolidays initializer.

tests/countries/test_afghanistan.py (7)

25-27: Good test setup for the new parameter

Creating a separate test instance with islamic_show_estimated=False is a clean approach to testing both behaviors.


114-115: Effective use of the no_estimated_holidays instance

Well implemented test that verifies holiday names without the estimated label.


134-134: Consistent testing pattern

Maintaining the same testing approach for all Islamic holidays ensures complete coverage of the new feature.


152-152: Consistent testing pattern

Consistent approach for testing the First Day of Ramadan.


192-192: Consistent testing pattern

Consistent approach for testing Eid al-Fitr.


210-210: Consistent testing pattern

Consistent approach for testing Arafah Day.


250-250: Consistent testing pattern

Consistent approach for testing Eid al-Adha.

holidays/countries/kenya.py (2)

56-60: Well-implemented parameter addition

The parameter implementation is clear and consistent with the pattern used in other country classes.


64-66: Parameter correctly passed to superclass

Good implementation of passing the parameter to the IslamicHolidays superclass.

holidays/countries/kazakhstan.py (3)

95-99: Consistent parameter implementation

The parameter follows the same pattern established in other country classes, maintaining codebase consistency.


102-104: Parameter correctly passed to superclass

Good implementation of passing the parameter to the IslamicHolidays initializer.


95-104:

✅ Verification successful

Verify change impact across other Islamic holidays

You should verify that the change properly affects the "Eid al-Adha" holiday that's being added at line 176.


🏁 Script executed:

#!/bin/bash
# Check if the `show_estimated` parameter is being used in IslamicHolidays class

# Search for the IslamicHolidays class implementation to understand how show_estimated is used
echo "Checking IslamicHolidays class implementation:"
rg -A 15 "class IslamicHolidays" --type py

# Check the eid_al_adha_day method specifically
echo -e "\nChecking eid_al_adha_day method:"
rg "_add_eid_al_adha_day" --type py

Length of output: 9231


Action: Confirm Eid al-Adha Behavior with show_estimated Parameter

After reviewing the changes, the IslamicHolidays class correctly accepts and stores the show_estimated parameter, and its usage (including in the _add_eid_al_adha_day method) is consistent across several country modules. In the Kazakhstan file, the instantiation:

  • Passes islamic_show_estimated into IslamicHolidays.__init__
  • Ultimately calls _add_eid_al_adha_day (as seen at line 176), matching the pattern observed in other countries

Please verify at runtime that the "estimated" label is applied as expected for Eid al-Adha when the parameter is enabled. Overall, the change impact on Islamic holidays appears correct.

holidays/countries/india.py (2)

74-78: Parameter addition looks good

The new parameter islamic_show_estimated is well-defined with proper type annotation and a clear docstring explaining its purpose. This enhancement allows users to control whether estimated labels are shown for Islamic holidays.


80-80: Correctly implements the parameter usage

The parameter is correctly passed to the IslamicHolidays initializer, maintaining consistent behavior across the inheritance chain.

holidays/countries/malaysia.py (4)

13-13: Appropriate import addition

Adding the date import from datetime is necessary to support the type annotation added later in the file.


129-133: Parameter addition is well-documented

The new parameter islamic_show_estimated is clearly defined with an appropriate type annotation and helpful docstring.


154-156: Parameter correctly passed to superclass

The implementation properly passes the new parameter to the IslamicHolidays initializer, ensuring consistent behavior.


160-160: Enhanced type annotation

Adding the type hint set[date] for self.dts_observed improves code clarity and aids static analysis tools.

holidays/countries/egypt.py (2)

38-42: Parameter addition with clear documentation

The new parameter islamic_show_estimated is well-defined with proper type annotation and helpful docstring explaining its purpose.


45-45: Correctly implements the new parameter

The parameter is properly passed to the IslamicHolidays initializer, maintaining consistent behavior.

holidays/countries/brunei.py (2)

133-137: Parameter addition is consistent with other classes

The new parameter islamic_show_estimated is well-defined with proper type annotation and clear docstring, consistent with implementations in other country classes.


141-143: Parameter correctly passed to superclass

The implementation properly passes the new parameter to the IslamicHolidays initializer while maintaining the existing cls parameter.

holidays/countries/uzbekistan.py (1)

41-49: Parameter addition for Islamic holiday estimation control

The addition of this parameter provides good flexibility for controlling whether to show "estimated" labels on Islamic holidays. The implementation correctly passes this parameter to the IslamicHolidays superclass.

tests/countries/test_indonesia.py (10)

24-26: Good test setup for no-estimated holiday testing

Creating a separate instance with islamic_show_estimated=False allows for clean testing of holiday names without estimation labels.


307-309: Cleaner test method implementation

Using unpacked range generators makes the code more concise while maintaining readability.


371-372: Direct holiday name assertion is clearer

Passing the string directly into the assertion makes the code more straightforward.


404-405: Proper use of new no_estimated_holidays instance

Using the instance created with islamic_show_estimated=False correctly tests the functionality of holiday names without estimated labels.


418-419: Consistent testing approach for second day

Same approach applied consistently for the second day of Eid al-Fitr.


432-433: Consistent pattern applied to Eid al-Adha

The same testing pattern is correctly applied across all Islamic holidays.


448-453: Thorough date range testing

Testing multiple date ranges ensures the implementation works correctly across different historical periods.


465-470: Consistent testing pattern for Prophet's Birthday

Testing pattern remains consistent across all Islamic holidays, maintaining good test structure.


483-488: Comprehensive coverage for Isra and Miraj

Tests cover both the presence and absence of holidays in appropriate year ranges.


504-507: Proper Islamic New Year testing

Testing both positive and negative cases across appropriate year ranges.

holidays/countries/ethiopia.py (1)

46-55: Consistent parameter implementation across country classes

The implementation follows the same pattern as other country classes, maintaining consistency in the codebase. Good docstring explaining the parameter's purpose.

tests/countries/test_united_arab_emirates.py (6)

24-26: Test setup for UAE follows consistent pattern

Creating the no_estimated_holidays instance follows the same pattern used in other country tests, ensuring consistency across the test suite.


85-87: Simplified holiday assertions for Eid al-Fitr

The direct holiday name assertions are cleaner and more straightforward than previous implementation that required checking year sets.


103-106: Comprehensive test coverage for Eid al-Adha and related holidays

Testing multiple related holidays ensures complete functionality coverage.


121-122: Simplified Islamic New Year assertions

Direct assertion with the no_estimated_holidays instance makes the test simpler and more maintainable.


137-138: Consistent testing for Prophet's Birthday

Maintains consistent testing pattern across all Islamic holidays.


142-143: Comprehensive testing for Isra and Miraj

Tests both presence in early years and absence in later years, ensuring accuracy across the entire year range.

PPsyrius
PPsyrius previously approved these changes Mar 4, 2025
# Conflicts:
#	holidays/countries/indonesia.py
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 8, 2025

@arkid15r arkid15r enabled auto-merge March 9, 2025 02:47
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 Mar 9, 2025
Merged via the queue into vacanza:dev with commit 9abd47f Mar 9, 2025
33 checks passed
@KJhellico KJhellico deleted the upd-islamic-poc branch March 9, 2025 09:17
@KJhellico KJhellico mentioned this pull request Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants