-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update holidays/countries/algeria.py Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> * Added Algeria holidays * Update holidays/countries/algeria.py Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> * Forgot to run make tox * Typo in holidays/countries/algeria.py Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com> * -Merged latest beta branch from remote repo and added new entry for Algeria in holidays/registry.py -Fixed typo in holidays/countries/algeria.py * Addressing issues from latest review --------- Co-authored-by: ~Jhellico <KJhellico@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
184 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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,70 @@ | ||
from holidays.constants import JAN, JUL, NOV | ||
from holidays.holiday_base import HolidayBase | ||
from holidays.holiday_groups import IslamicHolidays, InternationalHolidays | ||
|
||
|
||
class Algeria(HolidayBase, InternationalHolidays, IslamicHolidays): | ||
""" | ||
References: | ||
- https://en.wikipedia.org/wiki/Public_holidays_in_Algeria | ||
""" | ||
|
||
country = "DZ" | ||
|
||
def __init__(self, *args, **kwargs): | ||
InternationalHolidays.__init__(self) | ||
IslamicHolidays.__init__(self) | ||
super().__init__(*args, **kwargs) | ||
|
||
def _populate(self, year): | ||
super()._populate(year) | ||
|
||
# New Year's Day. | ||
self._add_new_years_day("New Year's Day") | ||
|
||
# Amazigh New Year / Yennayer | ||
# In January 2018, Algeria declared Yennayer a national holiday | ||
if year >= 2018: | ||
self._add_holiday("Amazigh New Year", JAN, 12) | ||
|
||
# Labour Day | ||
self._add_labor_day("Labour Day") | ||
|
||
# Independence Day | ||
if year >= 1962: | ||
self._add_holiday("Independence Day", JUL, 5) | ||
|
||
# Revolution Day | ||
if year >= 1963: | ||
self._add_holiday("Revolution Day", NOV, 1) | ||
|
||
# Islamic New Year | ||
self._add_islamic_new_year_day("Islamic New Year") | ||
|
||
# Ashura | ||
self._add_ashura_day("Ashura Day") | ||
|
||
# Mawlid / Prophet's Birthday | ||
self._add_mawlid_day("Prophet's Birthday") | ||
|
||
# As of April 30, 2023. Algeria has 3 days of Eid holidays | ||
# (https://www.horizons.dz/english/archives/amp/12021) | ||
# Eid al-Fitr - Feast Festive | ||
self._add_eid_al_fitr_day("Eid al-Fitr") | ||
self._add_eid_al_fitr_day_two("Eid al-Fitr Holiday") | ||
if year >= 2024: | ||
self._add_eid_al_fitr_day_three("Eid al-Fitr Holiday") | ||
|
||
# Eid al-Adha - Scarfice Festive | ||
self._add_eid_al_adha_day("Eid al-Adha") | ||
self._add_eid_al_adha_day_two("Eid al-Adha Holiday") | ||
if year >= 2023: | ||
self._add_eid_al_adha_day_three("Eid al-Adha Holiday") | ||
|
||
|
||
class DZ(Algeria): | ||
pass | ||
|
||
|
||
class DZA(Algeria): | ||
pass |
This file contains 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 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,108 @@ | ||
from holidays.countries.algeria import Algeria, DZ, DZA | ||
from tests.common import TestCase | ||
|
||
|
||
class TestAlgeria(TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass(Algeria) | ||
|
||
def test_country_aliases(self): | ||
self.assertCountryAliases(Algeria, DZ, DZA) | ||
|
||
def test_2022(self): | ||
self.assertHoliday( | ||
"2022-01-01", | ||
"2022-01-12", | ||
"2022-05-01", | ||
"2022-05-02", | ||
"2022-05-03", | ||
"2022-07-05", | ||
"2022-07-09", | ||
"2022-07-10", | ||
"2022-11-01", | ||
) | ||
|
||
def test_new_year_day(self): | ||
self.assertHoliday( | ||
"2022-01-01", | ||
"2023-01-01", | ||
) | ||
|
||
def test_independence_day(self): | ||
self.assertNoHoliday( | ||
"1961-07-05", | ||
"1962-07-04", | ||
) | ||
self.assertHoliday( | ||
"1962-07-05", | ||
"1963-07-05", | ||
) | ||
|
||
def test_revolution_day(self): | ||
self.assertNoHoliday("1962-11-01") | ||
self.assertHoliday("1963-11-01") | ||
|
||
def test_amazigh_new_year(self): | ||
self.assertNoHoliday("2017-01-12") | ||
self.assertHoliday( | ||
"2018-01-12", | ||
"2023-01-12", | ||
) | ||
|
||
def test_labour_day(self): | ||
self.assertNoHoliday( | ||
"2021-05-02", | ||
"2022-05-04", | ||
"2023-05-02", | ||
) | ||
self.assertHoliday( | ||
"2021-05-01", | ||
"2022-05-01", | ||
"2023-05-01", | ||
) | ||
|
||
def test_islamic_holidays(self): | ||
# Eid al-Fitr - Feast Festive | ||
self.assertNoHoliday("2023-04-20") | ||
self.assertHoliday( | ||
"2023-04-21", | ||
"2023-04-22", | ||
) | ||
|
||
# Eid al-Adha - Scarfice Festive | ||
self.assertNoHoliday( | ||
"2023-06-27", | ||
"2023-07-02", | ||
"2024-07-15", | ||
"2024-07-19", | ||
) | ||
self.assertHoliday( | ||
"2023-06-28", | ||
"2023-06-29", | ||
"2023-06-30", | ||
"2024-06-16", | ||
"2024-06-17", | ||
"2024-06-18", | ||
) | ||
|
||
# Islamic New Year | ||
self.assertHoliday( | ||
"2008-01-10", | ||
"2008-12-29", | ||
"2020-08-20", | ||
) | ||
|
||
# Ashura | ||
self.assertNoHoliday("2023-07-29") | ||
self.assertHoliday("2023-07-28") | ||
|
||
# Mawlid / Prophet's Birthday | ||
self.assertNoHoliday( | ||
"2021-10-19", | ||
"2023-09-28", | ||
) | ||
self.assertHoliday( | ||
"2021-10-18", | ||
"2023-09-27", | ||
) |