1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
# 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 CONTRIBUTORS 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.western_sahara import WesternSahara
from tests.common import CommonCountryTests
class TestWesternSahara(CommonCountryTests, TestCase):
@classmethod
def setUpClass(cls):
cls.full_range = range(2000, 2050)
super().setUpClass(WesternSahara, years=cls.full_range)
cls.no_estimated_holidays = WesternSahara(
years=cls.full_range, islamic_show_estimated=False
)
def test_proclamation_of_the_sadr(self):
self.assertHolidayName(
"إعلان الجمهورية العربية الصحراوية الديمقراطية",
(f"{year}-02-27" for year in self.full_range),
)
def test_first_martyr(self):
self.assertHolidayName("يوم الشهيد الأول", (f"{year}-03-08" for year in self.full_range))
def test_creation_of_the_polisario_front(self):
self.assertHolidayName(
"تأسيس الجبهة الشعبية لتحرير الساقية الحمراء ووادي الذهب",
(f"{year}-05-10" for year in self.full_range),
)
def test_commencement_of_the_armed_struggle(self):
self.assertHolidayName(
"اندلاع الكفاح المسلح", (f"{year}-05-20" for year in self.full_range)
)
def test_martyrs_day(self):
self.assertHolidayName("يوم الشهداء", (f"{year}-06-09" for year in self.full_range))
def test_uprising_day(self):
self.assertHolidayName("يوم الانتفاضة", (f"{year}-06-17" for year in self.full_range))
def test_national_unity_day(self):
self.assertHolidayName("عيد الوحدة الوطنية", (f"{year}-10-12" for year in self.full_range))
def test_islamic_new_year(self):
name = "رأس السنة الهجرية"
self.assertHolidayName(
name,
self.no_estimated_holidays,
"2020-08-20",
"2021-08-09",
"2022-07-30",
"2023-07-19",
"2024-07-07",
"2025-06-26",
)
self.assertHolidayName(name, self.no_estimated_holidays, range(2004, 2050))
self.assertNoHolidayName(name, self.no_estimated_holidays, range(2000, 2004))
def test_prophets_birthday(self):
name = "المولد النبوي الشريف"
self.assertHolidayName(
name,
self.no_estimated_holidays,
"2020-10-29",
"2021-10-18",
"2022-10-08",
"2023-09-27",
"2024-09-15",
"2025-09-04",
)
self.assertHolidayName(name, self.no_estimated_holidays, range(2004, 2050))
self.assertNoHolidayName(name, self.no_estimated_holidays, range(2000, 2004))
def test_eid_al_fitr(self):
name = "عيد الفطر المبارك"
self.assertHolidayName(
name,
self.no_estimated_holidays,
"2020-05-24",
"2021-05-13",
"2022-05-02",
"2023-04-21",
"2024-04-10",
"2025-03-30",
)
self.assertHolidayName(name, self.no_estimated_holidays, range(2003, 2050))
self.assertNoHolidayName(name, self.no_estimated_holidays, range(2000, 2003))
def test_eid_al_adha(self):
name = "عيد الأضحى المبارك"
self.assertHolidayName(
name,
self.no_estimated_holidays,
"2020-07-31",
"2021-07-20",
"2022-07-09",
"2023-06-28",
"2024-06-16",
"2025-06-06",
)
self.assertHolidayName(name, self.no_estimated_holidays, range(2004, 2050))
self.assertNoHolidayName(name, self.no_estimated_holidays, range(2000, 2004))
def test_l10n_default(self):
self.assertLocalizedHolidays(
("2024-02-27", "إعلان الجمهورية العربية الصحراوية الديمقراطية"),
("2024-03-08", "يوم الشهيد الأول"),
("2024-04-10", "عيد الفطر المبارك (المقدرة)"),
("2024-05-10", "تأسيس الجبهة الشعبية لتحرير الساقية الحمراء ووادي الذهب"),
("2024-05-20", "اندلاع الكفاح المسلح"),
("2024-06-09", "يوم الشهداء"),
("2024-06-16", "عيد الأضحى المبارك (المقدرة)"),
("2024-06-17", "يوم الانتفاضة"),
("2024-07-07", "رأس السنة الهجرية (المقدرة)"),
("2024-09-15", "المولد النبوي الشريف (المقدرة)"),
("2024-10-12", "عيد الوحدة الوطنية"),
)
def test_l10n_en_us(self):
self.assertLocalizedHolidays(
"en_US",
("2024-02-27", "Proclamation of the SADR"),
("2024-03-08", "First Martyr"),
("2024-04-10", "Eid al-Fitr (estimated)"),
("2024-05-10", "Creation of the Polisario Front"),
("2024-05-20", "Commencement of the Armed Struggle"),
("2024-06-09", "Martyrs' Day"),
("2024-06-16", "Eid al-Adha (estimated)"),
("2024-06-17", "Uprising Day"),
("2024-07-07", "Islamic New Year (estimated)"),
("2024-09-15", "Prophet's Birthday (estimated)"),
("2024-10-12", "National Unity Day"),
)
def test_l10n_es(self):
self.assertLocalizedHolidays(
"es",
("2024-02-27", "Proclamación de la República Árabe Saharaui Democrática"),
("2024-03-08", "Primer mártir"),
("2024-04-10", "Eid al-Fitr (estimado)"),
("2024-05-10", "Creación del Frente POLISARIO"),
("2024-05-20", "Inicio de la lucha armada"),
("2024-06-09", "Día de los mártires"),
("2024-06-16", "Eid al-Adha (estimado)"),
("2024-06-17", "Día de la insurrección"),
("2024-07-07", "Primer día del año de la Hégira (estimado)"),
("2024-09-15", "Santo Nacimiento del Profeta (estimado)"),
("2024-10-12", "Fiesta de la unidad nacional"),
)
def test_l10n_fr(self):
self.assertLocalizedHolidays(
"fr",
("2024-02-27", "Proclamation de la République arabe sahraouie démocratique"),
("2024-03-08", "Premier martyr"),
("2024-04-10", "Aïd el-Fitr (estimé)"),
("2024-05-10", "Création du Front POLISARIO"),
("2024-05-20", "Déclenchement de la lutte armée"),
("2024-06-09", "Journée des martyrs"),
("2024-06-16", "Aïd al-Adha (estimé)"),
("2024-06-17", "Jour de l'insurrection"),
("2024-07-07", "Premier jour de l'an de l'Hégire (estimé)"),
("2024-09-15", "Naissance du Prophète (estimé)"),
("2024-10-12", "Fête de l'unité nationale"),
)
|