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 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
|
# 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.tonga import Tonga
from tests.common import CommonCountryTests
class TestTonga(CommonCountryTests, TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass(Tonga, years=range(1989, 2050), years_non_observed=range(1989, 2050))
def test_special_holidays(self):
self.assertHoliday(
"2017-11-29",
"2019-09-19",
"2019-11-15",
)
self.assertNoNonObservedHoliday(
# 2021 Boxing Day
"2021-12-27",
)
def test_government_actual_date_observance(self):
self.assertNonObservedHoliday(
# Emancipation Day.
"2017-06-04",
"2019-06-04",
"2020-06-04",
"2021-06-04",
"2022-06-04",
"2023-06-04",
"2024-06-04",
# Constitution Day.
"2017-11-04",
"2018-11-04",
"2020-11-04",
"2021-11-04",
"2022-11-04",
"2023-11-04",
# HM King Topou I's Coronation Day.
"2018-12-04",
"2019-12-04",
"2021-12-04",
"2022-12-04",
"2024-12-04",
)
def test_birthday_of_the_reigning_sovereign(self):
name = "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"
self.assertHolidayName(name, (f"{year}-07-04" for year in range(1989, 2007)))
self.assertHolidayName(name, (f"{year}-05-04" for year in range(2007, 2011)))
self.assertNoHolidayName(name, 2012)
self.assertHolidayName(name, (f"{year}-07-04" for year in range(2013, 2050)))
self.assertNoNonObservedHoliday(
# Topou IV.
"1993-07-05",
"1999-07-05",
"2004-07-05",
# Topou V.
"2008-05-05",
# Topou V (Act 10 of 2010).
"2011-05-02",
# Topou VI.
"2021-07-05",
"2027-07-05",
)
self.assertNonObservedHoliday(
# Topou V (Act 10 of 2010).
"2011-05-04",
)
def test_birthday_of_the_heir_to_the_crown(self):
name = "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"
self.assertHolidayName(name, (f"{year}-05-04" for year in range(1989, 2007)))
self.assertHolidayName(name, (f"{year}-07-12" for year in range(2007, 2011)))
self.assertHolidayName(name, (f"{year}-09-17" for year in range(2012, 2050)))
self.assertNoNonObservedHoliday(
# Topou IV's Heir: Topou V.
"1997-05-05",
"2003-05-05",
# Topou V's Heir: Topou VI.
"2009-07-13",
# Topou V's Heir: Topou VI (Act 10 of 2010).
"2011-07-11",
# Topou VI's Heir: Tupouto'a 'Ulukalala.
"2017-09-18",
"2023-09-18",
"2028-09-18",
)
self.assertNonObservedHoliday(
# Topou V's Heir: Topou VI (Act 10 of 2010).
"2011-07-12",
)
def test_coronation_day_anniversary(self):
name = (
"Fakamanatu 'o e 'Aho Hilifaki Kalauni 'o 'Ene 'Afio ko e Tu'i 'o Tonga "
"'a ia 'oku lolotonga Pule"
)
self.assertNoHolidayName(name, range(1989, 2008))
self.assertHolidayName(name, (f"{year}-08-01" for year in {2008, 2009, 2011}))
self.assertNoHolidayName(name, range(2012, 2050))
self.assertNoNonObservedHoliday(
# Topou V (Act 10 of 2010).
"2010-08-02",
)
self.assertNonObservedHoliday(
# Topou V (Act 10 of 2010).
"2010-08-01",
)
def test_2017(self):
# https://www.officeholidays.com/countries/tonga/2017
self.assertHolidaysInYear(
2017,
("2017-01-01", "'Uluaki 'Aho 'o e Ta'u Fo'ou"),
("2017-04-14", "Falaite Lelei"),
("2017-04-17", "Monite 'o e Toetu'u"),
("2017-04-25", "'Aho Anzac"),
("2017-06-05", "'Aho Tau'ataina (fakatokanga'i)"),
("2017-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"),
("2017-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"),
("2017-09-18", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga (fakatokanga'i)"),
("2017-11-06", "'Aho Konisitutone (fakatokanga'i)"),
("2017-11-29", "'Aho malolo 'akapulu 'a Tonga"),
(
"2017-12-04",
"'Aho Fakamanatu 'o e Hilifaki Kalauni 'o 'Ene 'Afio ko Siaosi Tupou I",
),
("2017-12-25", "'Aho Kilisimasi"),
("2017-12-26", "'Aho 2 'o e Kilisimasi"),
)
def test_2018(self):
# https://www.gov.to/press-release/tonga-public-holidays-for-2018/
self.assertHolidaysInYear(
2018,
("2018-01-01", "'Uluaki 'Aho 'o e Ta'u Fo'ou"),
("2018-03-30", "Falaite Lelei"),
("2018-04-02", "Monite 'o e Toetu'u"),
("2018-04-25", "'Aho Anzac"),
("2018-06-04", "'Aho Tau'ataina"),
("2018-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"),
("2018-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"),
("2018-11-05", "'Aho Konisitutone (fakatokanga'i)"),
(
"2018-12-03",
(
"'Aho Fakamanatu 'o e Hilifaki Kalauni 'o 'Ene 'Afio ko "
"Siaosi Tupou I (fakatokanga'i)"
),
),
("2018-12-25", "'Aho Kilisimasi"),
("2018-12-26", "'Aho 2 'o e Kilisimasi"),
)
def test_2019(self):
# https://www.gov.to/press-release/tonga-public-holidays-for-2019-2/
self.assertHolidaysInYear(
2019,
("2019-01-01", "'Uluaki 'Aho 'o e Ta'u Fo'ou"),
("2019-04-19", "Falaite Lelei"),
("2019-04-22", "Monite 'o e Toetu'u"),
("2019-04-25", "'Aho Anzac"),
("2019-06-03", "'Aho Tau'ataina (fakatokanga'i)"),
("2019-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"),
("2019-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"),
("2019-09-19", "Me'afaka'eiki 'o e Siteiti 'Akilisi Pohiva"),
("2019-11-04", "'Aho Konisitutone"),
("2019-11-15", "'Aho malolo 'akapulu 'a Tonga"),
(
"2019-12-02",
(
"'Aho Fakamanatu 'o e Hilifaki Kalauni 'o 'Ene 'Afio ko "
"Siaosi Tupou I (fakatokanga'i)"
),
),
("2019-12-25", "'Aho Kilisimasi"),
("2019-12-26", "'Aho 2 'o e Kilisimasi"),
)
def test_2020(self):
# https://www.gov.to/press-release/tonga-public-holidays-for-2020/
self.assertHolidaysInYear(
2020,
("2020-01-01", "'Uluaki 'Aho 'o e Ta'u Fo'ou"),
("2020-04-10", "Falaite Lelei"),
("2020-04-13", "Monite 'o e Toetu'u"),
("2020-04-25", "'Aho Anzac"),
("2020-06-08", "'Aho Tau'ataina (fakatokanga'i)"),
("2020-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"),
("2020-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"),
("2020-11-02", "'Aho Konisitutone (fakatokanga'i)"),
(
"2020-12-07",
(
"'Aho Fakamanatu 'o e Hilifaki Kalauni 'o 'Ene 'Afio ko "
"Siaosi Tupou I (fakatokanga'i)"
),
),
("2020-12-25", "'Aho Kilisimasi"),
("2020-12-26", "'Aho 2 'o e Kilisimasi"),
)
def test_2021(self):
# https://www.gov.to/press-release/tonga-public-holidays-for-2021/
self.assertHolidaysInYear(
2021,
("2021-01-01", "'Uluaki 'Aho 'o e Ta'u Fo'ou"),
("2021-04-02", "Falaite Lelei"),
("2021-04-05", "Monite 'o e Toetu'u"),
("2021-04-25", "'Aho Anzac"),
("2021-06-07", "'Aho Tau'ataina (fakatokanga'i)"),
("2021-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"),
(
"2021-07-05",
(
"'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku "
"lolotonga Pule (fakatokanga'i)"
),
),
("2021-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"),
("2021-11-08", "'Aho Konisitutone (fakatokanga'i)"),
(
"2021-12-06",
(
"'Aho Fakamanatu 'o e Hilifaki Kalauni 'o 'Ene 'Afio ko "
"Siaosi Tupou I (fakatokanga'i)"
),
),
("2021-12-25", "'Aho Kilisimasi"),
("2021-12-26", "'Aho 2 'o e Kilisimasi"),
("2021-12-27", "'Aho 2 'o e Kilisimasi (fakatokanga'i)"), # ???
)
def test_2022(self):
# https://www.gov.to/press-release/tonga-public-holidays-for-2022/
self.assertHolidaysInYear(
2022,
("2022-01-01", "'Uluaki 'Aho 'o e Ta'u Fo'ou"),
("2022-04-15", "Falaite Lelei"),
("2022-04-18", "Monite 'o e Toetu'u"),
("2022-04-25", "'Aho Anzac"),
("2022-06-06", "'Aho Tau'ataina (fakatokanga'i)"),
("2022-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"),
("2022-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"),
("2022-11-07", "'Aho Konisitutone (fakatokanga'i)"),
(
"2022-12-05",
(
"'Aho Fakamanatu 'o e Hilifaki Kalauni 'o 'Ene 'Afio ko "
"Siaosi Tupou I (fakatokanga'i)"
),
),
("2022-12-25", "'Aho Kilisimasi"),
("2022-12-26", "'Aho 2 'o e Kilisimasi"),
)
def test_2024(self):
# https://www.gov.to/press-release/tonga-public-holidays-for-2024/
self.assertHolidaysInYear(
2024,
("2024-01-01", "'Uluaki 'Aho 'o e Ta'u Fo'ou"),
("2024-03-29", "Falaite Lelei"),
("2024-04-01", "Monite 'o e Toetu'u"),
("2024-04-25", "'Aho Anzac"),
("2024-06-03", "'Aho Tau'ataina (fakatokanga'i)"),
("2024-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"),
("2024-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"),
("2024-11-04", "'Aho Konisitutone"),
(
"2024-12-02",
(
"'Aho Fakamanatu 'o e Hilifaki Kalauni 'o 'Ene 'Afio ko "
"Siaosi Tupou I (fakatokanga'i)"
),
),
("2024-12-25", "'Aho Kilisimasi"),
("2024-12-26", "'Aho 2 'o e Kilisimasi"),
)
def test_l10n_default(self):
# https://www.gov.to/press-release/tonga-public-holidays-for-2023/
self.assertLocalizedHolidays(
("2023-01-01", "'Uluaki 'Aho 'o e Ta'u Fo'ou"),
("2023-04-07", "Falaite Lelei"),
("2023-04-10", "Monite 'o e Toetu'u"),
("2023-04-25", "'Aho Anzac"),
("2023-06-05", "'Aho Tau'ataina (fakatokanga'i)"),
("2023-07-04", "'Aho 'Alo'i 'o 'Ene 'Afio ko e Tu'i 'o Tonga 'oku lolotonga Pule"),
("2023-09-17", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga"),
("2023-09-18", "'Aho 'Alo'i 'o e 'Ea ki he Kalauni 'o Tonga (fakatokanga'i)"),
("2023-11-06", "'Aho Konisitutone (fakatokanga'i)"),
(
"2023-12-04",
"'Aho Fakamanatu 'o e Hilifaki Kalauni 'o 'Ene 'Afio ko Siaosi Tupou I",
),
("2023-12-25", "'Aho Kilisimasi"),
("2023-12-26", "'Aho 2 'o e Kilisimasi"),
)
def test_l10n_en_us(self):
self.assertLocalizedHolidays(
"en_US",
("2023-01-01", "New Year's Day"),
("2023-04-07", "Good Friday"),
("2023-04-10", "Easter Monday"),
("2023-04-25", "Anzac Day"),
("2023-06-05", "Emancipation Day (observed)"),
("2023-07-04", "Birthday of the Reigning Sovereign of Tonga"),
("2023-09-17", "Birthday of the Heir to the Crown of Tonga"),
("2023-09-18", "Birthday of the Heir to the Crown of Tonga (observed)"),
("2023-11-06", "Constitution Day (observed)"),
("2023-12-04", "Anniversary of the Coronation of HM King George Tupou I"),
("2023-12-25", "Christmas Day"),
("2023-12-26", "Boxing Day"),
)
|