-
-
Notifications
You must be signed in to change notification settings - Fork 539
Added Turkmenistan holidays #2416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Nabeel-Ahmad07
wants to merge
8
commits into
vacanza:dev
from
Nabeel-Ahmad07:add-turkmenistan-holidays
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
616fff9
Added Turkmenistan holidays
Nabeel-Ahmad07 2440847
Updated
Nabeel-Ahmad07 92de332
Merge branch 'dev' into add-turkmenistan-holidays
Nabeel-Ahmad07 afdd58a
Fixed Pre-commit issues
Nabeel-Ahmad07 c7050d0
Merge branch 'dev' into add-turkmenistan-holidays
Nabeel-Ahmad07 ba86fd5
Update tests/countries/test_turkmenistan.py
Nabeel-Ahmad07 1755f1f
Fixed Pre-commit issues after Code-Rabbit commit
Nabeel-Ahmad07 cb6479d
Merge branch 'dev' into add-turkmenistan-holidays
arkid15r File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# holidays | ||
# -------- | ||
# A fast, efficient Python library for generating country, province and state | ||
# specific sets of holidays on the fly. It aims to make determining whether a | ||
# specific date is a holiday as fast and flexible as possible. | ||
# | ||
# Authors: Vacanza Team and individual contributors (see AUTHORS.md file) | ||
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
# ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
# Website: https://github.com/vacanza/holidays | ||
# License: MIT (see LICENSE file) | ||
|
||
from gettext import gettext as tr | ||
|
||
from holidays.groups import InternationalHolidays, IslamicHolidays | ||
from holidays.holiday_base import HolidayBase | ||
|
||
|
||
class Turkmenistan(HolidayBase, InternationalHolidays, IslamicHolidays): | ||
"""Turkmenistan holidays. | ||
|
||
References: | ||
* https://en.wikipedia.org/wiki/Public_holidays_in_Turkmenistan | ||
* https://www.timeanddate.com/holidays/turkmenistan/ | ||
* https://www.mfa.gov.tm/en/articles/2 | ||
""" | ||
|
||
country = "TM" | ||
default_language = "tk" | ||
start_year = 1992 | ||
supported_languages = ("en_US", "tk", "ru") | ||
|
||
def __init__(self, *args, **kwargs): | ||
InternationalHolidays.__init__(self) | ||
IslamicHolidays.__init__(self) | ||
super().__init__(*args, **kwargs) | ||
|
||
def _populate_public_holidays(self): | ||
# New Year's Day | ||
name = tr("Жаңа жыл") | ||
self._add_new_years_day(name) | ||
self._add_new_years_day_two(name) | ||
|
||
# Memorial Day | ||
self._add_holiday_jan_12(tr("Хатыра гүни (Memorial Day)")) | ||
|
||
# Defender of the Fatherland Day | ||
if self._year >= 2009: | ||
self._add_holiday_jan_27(tr("Ватанмухадызларың гүни")) | ||
|
||
# International Women's Day | ||
self._add_womens_day(tr("Халықаралық әйелдер күні")) | ||
|
||
# Nowruz | ||
name = tr("Наурыз мейрамы") | ||
self._add_holiday_mar_21(name) | ||
self._add_holiday_mar_22(name) | ||
|
||
# Victory Day | ||
self._add_holiday_may_9(tr("Жеңиш гүни")) | ||
|
||
# Constitution and Revival Day | ||
if self._year >= 2018: | ||
self._add_holiday_may_18(tr("Конституция ве Түзелиш гүни")) | ||
else: | ||
self._add_holiday_may_18(tr("Түзелиш гүни")) | ||
|
||
# Independence Day | ||
if self._year <= 2017: | ||
self._add_holiday_oct_27(tr("Гарашсызлык гүни")) | ||
else: | ||
self._add_holiday_sep_27(tr("Гарашсызлык гүни")) | ||
|
||
# Day of Remembrance | ||
if self._year >= 2015: | ||
self._add_holiday_oct_6(tr("Хатыра гүни (Day of Remembrance)")) | ||
|
||
# Neutrality Day | ||
if self._year >= 2023: | ||
self._add_holiday_dec_12(tr("Битараплык гүни")) | ||
elif self._year >= 2018: | ||
self._add_holiday_jun_27(tr("Түркменистаның битараплык гүни")) | ||
elif self._year >= 1995: | ||
self._add_holiday_dec_12(tr("Битараплык гүни")) | ||
|
||
# Islamic Holidays | ||
self._add_eid_al_fitr_day(tr("Ораза байрамы")) | ||
self._add_eid_al_fitr_day_two(tr("Ораза байрамы")) | ||
self._add_eid_al_fitr_day_three(tr("Ораза байрамы")) | ||
|
||
self._add_eid_al_adha_day(tr("Гурбан байрамы")) | ||
self._add_eid_al_adha_day_two(tr("Гурбан байрамы")) | ||
self._add_eid_al_adha_day_three(tr("Гурбан байрамы")) | ||
|
||
|
||
class TM(Turkmenistan): | ||
pass | ||
|
||
|
||
class TKM(Turkmenistan): | ||
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# holidays | ||
# -------- | ||
# A fast, efficient Python library for generating country, province and state | ||
# specific sets of holidays on the fly. It aims to make determining whether a | ||
# specific date is a holiday as fast and flexible as possible. | ||
# | ||
# Authors: Vacanza Team and individual contributors (see AUTHORS.md file) | ||
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023 | ||
# ryanss <ryanssdev@icloud.com> (c) 2014-2017 | ||
# Website: https://github.com/vacanza/holidays | ||
# License: MIT (see LICENSE file) | ||
|
||
from unittest import TestCase | ||
|
||
from holidays.countries.turkmenistan import Turkmenistan, TM, TKM | ||
from tests.common import CommonCountryTests, WorkingDayTests | ||
|
||
|
||
class TestTurkmenistan(CommonCountryTests, WorkingDayTests, TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass(Turkmenistan, years=range(1992, 2050)) | ||
|
||
def test_country_aliases(self): | ||
self.assertAliases(Turkmenistan, TM, TKM) | ||
|
||
def test_no_holidays(self): | ||
self.assertNoHolidays(Turkmenistan(years=1991)) | ||
|
||
def test_new_year(self): | ||
name = "Жаңа жыл" | ||
self.assertHolidayName(name, (f"{year}-01-01" for year in range(1992, 2050))) | ||
self.assertHolidayName(name, (f"{year}-01-02" for year in range(1992, 2050))) | ||
|
||
def test_memorial_day(self): | ||
self.assertHolidayName( | ||
"Хатыра гүни (Memorial Day)", (f"{year}-01-12" for year in range(1992, 2050)) | ||
) | ||
|
||
def test_defenders_day(self): | ||
name = "Ватанмухадызларың гүни" | ||
for year in range(2009, 2050): | ||
self.assertHolidayName(name, f"{year}-01-27") | ||
for year in range(1992, 2009): | ||
self.assertNoHolidayName(name, year) | ||
|
||
def test_womens_day(self): | ||
self.assertHolidayName( | ||
"Халықаралық әйелдер күні", (f"{year}-03-08" for year in range(1992, 2050)) | ||
) | ||
|
||
def test_nowruz(self): | ||
name = "Наурыз мейрамы" | ||
for year in range(1992, 2050): | ||
self.assertHolidayName(name, f"{year}-03-21") | ||
self.assertHolidayName(name, f"{year}-03-22") | ||
KJhellico marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def test_victory_day(self): | ||
self.assertHolidayName("Жеңиш гүни", (f"{year}-05-09" for year in range(1992, 2050))) | ||
|
||
def test_constitution_and_revival_day(self): | ||
for year in range(2018, 2050): | ||
self.assertHolidayName("Конституция ве Түзелиш гүни", f"{year}-05-18") | ||
for year in range(1992, 2018): | ||
self.assertHolidayName("Түзелиш гүни", f"{year}-05-18") | ||
|
||
def test_independence_day(self): | ||
for year in range(1992, 2018): | ||
self.assertHolidayName("Гарашсызлык гүни", f"{year}-10-27") | ||
for year in range(2018, 2050): | ||
self.assertHolidayName("Гарашсызлык гүни", f"{year}-09-27") | ||
|
||
def test_day_of_remembrance(self): | ||
for year in range(2015, 2050): | ||
self.assertHolidayName("Хатыра гүни (Day of Remembrance)", f"{year}-10-06") | ||
|
||
def test_neutrality_day(self): | ||
for year in range(2023, 2050): | ||
self.assertHolidayName("Битараплык гүни", f"{year}-12-12") | ||
for year in range(2018, 2023): | ||
self.assertHolidayName("Түркменистаның битараплык гүни", f"{year}-06-27") | ||
for year in range(1995, 2018): | ||
self.assertHolidayName("Битараплык гүни", f"{year}-12-12") | ||
|
||
def test_eid_al_fitr(self): | ||
self.assertHolidayName("Ораза байрамы (estimated)", "2024-04-10") | ||
self.assertHolidayName("Ораза байрамы (estimated)", "2025-04-01") | ||
|
||
def test_eid_al_adha(self): | ||
self.assertHolidayName("Гурбан байрамы (estimated)", "2024-06-16") | ||
self.assertHolidayName("Гурбан байрамы (estimated)", "2025-06-06") | ||
|
||
def test_localization(self): | ||
languages = {"tk": "Turkmen", "ru": "Russian", "en_US": "English"} | ||
|
||
for lang_code, lang_name in languages.items(): | ||
try: | ||
holidays = Turkmenistan(years=range(1992, 2050), language=lang_code) | ||
for holiday in holidays: | ||
self.assertEqual( | ||
holiday.lang, | ||
lang_code, | ||
f"Holiday {holiday.name} not localized in {lang_name}.", | ||
) | ||
except FileNotFoundError: | ||
self.skipTest(f"{lang_name} language translation files not found") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.