File: test_dominica.py

package info (click to toggle)
python-holidays 0.86-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 57,296 kB
  • sloc: python: 117,830; javascript: 85; makefile: 59
file content (479 lines) | stat: -rw-r--r-- 17,883 bytes parent folder | download
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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
#  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.dominica import Dominica
from tests.common import CommonCountryTests


class TestDominica(CommonCountryTests, TestCase):
    @classmethod
    def setUpClass(cls):
        super().setUpClass(Dominica)

    def test_special_holidays(self):
        self.assertHoliday(
            "2009-07-28",
            "2009-09-03",
            "2010-01-04",
            "2019-09-19",
        )

    def test_new_years_day(self):
        name = "New Year's Day"
        self.assertHolidayName(name, (f"{year}-01-01" for year in self.full_range))

        obs_dts = (
            "2012-01-02",
            "2017-01-02",
            "2023-01-02",
        )
        self.assertHolidayName(f"{name} (observed)", obs_dts)
        self.assertNoNonObservedHoliday(obs_dts)

    def test_carnival_monday(self):
        name = "Carnival Monday"
        self.assertHolidayName(
            name,
            "2020-02-24",
            "2021-02-15",
            "2022-02-28",
            "2023-02-20",
            "2024-02-12",
            "2025-03-03",
        )
        self.assertHolidayName(name, self.full_range)

    def test_carnival_tuesday(self):
        name = "Carnival Tuesday"
        self.assertHolidayName(
            name,
            "2020-02-25",
            "2021-02-16",
            "2022-03-01",
            "2023-02-21",
            "2024-02-13",
            "2025-03-04",
        )
        self.assertHolidayName(name, self.full_range)

    def test_good_friday(self):
        name = "Good Friday"
        self.assertHolidayName(
            name,
            "2020-04-10",
            "2021-04-02",
            "2022-04-15",
            "2023-04-07",
            "2024-03-29",
            "2025-04-18",
        )
        self.assertHolidayName(name, self.full_range)

    def test_easter_monday(self):
        name = "Easter Monday"
        self.assertHolidayName(
            name,
            "2020-04-13",
            "2021-04-05",
            "2022-04-18",
            "2023-04-10",
            "2024-04-01",
            "2025-04-21",
        )
        self.assertHolidayName(name, self.full_range)

    def test_labor_day(self):
        name = "Labour Day"
        self.assertHolidayName(name, (f"{year}-05-01" for year in range(self.start_year, 2010)))
        self.assertHolidayName(
            name,
            "2020-05-04",
            "2021-05-03",
            "2022-05-02",
            "2023-05-01",
            "2024-05-06",
            "2025-05-05",
        )
        self.assertHolidayName(name, range(2010, self.end_year))

        obs_dts = (
            "1994-05-02",
            "2005-05-02",
        )
        self.assertHolidayName(f"{name} (observed)", obs_dts)
        self.assertNoNonObservedHoliday(obs_dts)

    def test_emancipation_day(self):
        name_1990 = "First Monday of August"
        name_1998 = "Emancipation Day"

        self.assertHolidayName(
            name_1998,
            "2020-08-03",
            "2021-08-02",
            "2022-08-01",
            "2023-08-07",
            "2024-08-05",
            "2025-08-04",
        )
        self.assertHolidayName(name_1990, range(self.start_year, 1998))
        self.assertHolidayName(name_1998, range(1998, self.end_year))
        self.assertNoHolidayName(name_1990, range(1998, self.end_year))
        self.assertNoHolidayName(name_1998, range(self.start_year, 1998))

    def test_whit_monday(self):
        name = "Whit Monday"
        self.assertHolidayName(
            name,
            "2020-06-01",
            "2021-05-24",
            "2022-06-06",
            "2023-05-29",
            "2024-05-20",
            "2025-06-09",
        )
        self.assertHolidayName(name, self.full_range)

    def test_independence_day(self):
        name = "Independence Day"
        self.assertHolidayName(name, (f"{year}-11-03" for year in self.full_range))

        obs_dts = (
            "2013-11-05",
            "2019-11-05",
            "2024-11-05",
        )
        self.assertHolidayName(f"{name} (observed)", obs_dts)
        self.assertNoNonObservedHoliday(obs_dts)

    def test_national_day_of_community_service(self):
        name = "National Day of Community Service"
        self.assertHolidayName(name, (f"{year}-11-04" for year in self.full_range))

        obs_dts = (
            "2007-11-05",
            "2012-11-05",
            "2018-11-05",
        )
        self.assertHolidayName(f"{name} (observed)", obs_dts)
        self.assertNoNonObservedHoliday(obs_dts)

    def test_christmas_day(self):
        name = "Christmas Day"
        self.assertHolidayName(name, (f"{year}-12-25" for year in self.full_range))

        obs_dts = (
            "2011-12-27",
            "2016-12-27",
            "2022-12-27",
        )
        self.assertHolidayName(f"{name} (observed)", obs_dts)
        self.assertNoNonObservedHoliday(obs_dts)

    def test_boxing_day(self):
        name = "Boxing Day"
        self.assertHolidayName(name, (f"{year}-12-26" for year in self.full_range))

        obs_dts = (
            "2004-12-27",
            "2010-12-27",
            "2021-12-27",
        )
        self.assertHolidayName(f"{name} (observed)", obs_dts)
        self.assertNoNonObservedHoliday(obs_dts)

    def test_2010_public_holidays(self):
        # https://www.dominica-weekly.com/images/dominica-calendar-2010/1600-1280.jpg
        self.assertHolidaysInYear(
            2010,
            ("2010-01-01", "New Year's Day"),
            ("2010-01-04", "Special Public Holiday"),
            ("2010-02-15", "Carnival Monday"),
            ("2010-02-16", "Carnival Tuesday"),
            ("2010-04-02", "Good Friday"),
            ("2010-04-05", "Easter Monday"),
            ("2010-05-03", "Labour Day"),
            ("2010-05-24", "Whit Monday"),
            ("2010-08-02", "Emancipation Day"),
            ("2010-11-03", "Independence Day"),
            ("2010-11-04", "National Day of Community Service"),
            ("2010-12-25", "Christmas Day"),
            ("2010-12-26", "Boxing Day"),
            ("2010-12-27", "Boxing Day (observed)"),
        )

    def test_2011_public_holidays(self):
        # https://dominicaconsulategreece.com/dominica/public-holidays/
        self.assertHolidaysInYear(
            2011,
            ("2011-01-01", "New Year's Day"),
            ("2011-03-07", "Carnival Monday"),
            ("2011-03-08", "Carnival Tuesday"),
            ("2011-04-22", "Good Friday"),
            ("2011-04-25", "Easter Monday"),
            ("2011-05-02", "Labour Day"),
            ("2011-06-13", "Whit Monday"),
            ("2011-08-01", "Emancipation Day"),
            ("2011-11-03", "Independence Day"),
            ("2011-11-04", "National Day of Community Service"),
            ("2011-12-25", "Christmas Day"),
            ("2011-12-26", "Boxing Day"),
            ("2011-12-27", "Christmas Day (observed)"),
        )

    def test_2012_public_holidays(self):
        # https://dominicaconsulategreece.com/dominica/public-holidays/
        self.assertHolidaysInYear(
            2012,
            ("2012-01-01", "New Year's Day"),
            ("2012-01-02", "New Year's Day (observed)"),
            ("2012-02-20", "Carnival Monday"),
            ("2012-02-21", "Carnival Tuesday"),
            ("2012-04-06", "Good Friday"),
            ("2012-04-09", "Easter Monday"),
            ("2012-05-07", "Labour Day"),
            ("2012-05-28", "Whit Monday"),
            ("2012-08-06", "Emancipation Day"),
            ("2012-11-03", "Independence Day"),
            ("2012-11-04", "National Day of Community Service"),
            ("2012-11-05", "National Day of Community Service (observed)"),
            ("2012-12-25", "Christmas Day"),
            ("2012-12-26", "Boxing Day"),
        )

    def test_2013_public_holidays(self):
        # https://dominicaconsulategreece.com/dominica/public-holidays/
        self.assertHolidaysInYear(
            2013,
            ("2013-01-01", "New Year's Day"),
            ("2013-02-11", "Carnival Monday"),
            ("2013-02-12", "Carnival Tuesday"),
            ("2013-03-29", "Good Friday"),
            ("2013-04-01", "Easter Monday"),
            ("2013-05-06", "Labour Day"),
            ("2013-05-20", "Whit Monday"),
            ("2013-08-05", "Emancipation Day"),
            ("2013-11-03", "Independence Day"),
            ("2013-11-04", "National Day of Community Service"),
            ("2013-11-05", "Independence Day (observed)"),
            ("2013-12-25", "Christmas Day"),
            ("2013-12-26", "Boxing Day"),
        )

    def test_2014_public_holidays(self):
        # https://dominicaconsulategreece.com/dominica/public-holidays/
        self.assertHolidaysInYear(
            2014,
            ("2014-01-01", "New Year's Day"),
            ("2014-03-03", "Carnival Monday"),
            ("2014-03-04", "Carnival Tuesday"),
            ("2014-04-18", "Good Friday"),
            ("2014-04-21", "Easter Monday"),
            ("2014-05-05", "Labour Day"),
            ("2014-06-09", "Whit Monday"),
            ("2014-08-04", "Emancipation Day"),
            ("2014-11-03", "Independence Day"),
            ("2014-11-04", "National Day of Community Service"),
            ("2014-12-25", "Christmas Day"),
            ("2014-12-26", "Boxing Day"),
        )

    def test_2015_public_holidays(self):
        # https://dominicaconsulategreece.com/dominica/public-holidays/
        self.assertHolidaysInYear(
            2015,
            ("2015-01-01", "New Year's Day"),
            ("2015-02-16", "Carnival Monday"),
            ("2015-02-17", "Carnival Tuesday"),
            ("2015-04-03", "Good Friday"),
            ("2015-04-06", "Easter Monday"),
            ("2015-05-04", "Labour Day"),
            ("2015-05-25", "Whit Monday"),
            ("2015-08-03", "Emancipation Day"),
            ("2015-11-03", "Independence Day"),
            ("2015-11-04", "National Day of Community Service"),
            ("2015-12-25", "Christmas Day"),
            ("2015-12-26", "Boxing Day"),
        )

    def test_2016_public_holidays(self):
        # https://dominicaconsulategreece.com/dominica/public-holidays/
        self.assertHolidaysInYear(
            2016,
            ("2016-01-01", "New Year's Day"),
            ("2016-02-08", "Carnival Monday"),
            ("2016-02-09", "Carnival Tuesday"),
            ("2016-03-25", "Good Friday"),
            ("2016-03-28", "Easter Monday"),
            ("2016-05-02", "Labour Day"),
            ("2016-05-16", "Whit Monday"),
            ("2016-08-01", "Emancipation Day"),
            ("2016-11-03", "Independence Day"),
            ("2016-11-04", "National Day of Community Service"),
            ("2016-12-25", "Christmas Day"),
            ("2016-12-26", "Boxing Day"),
            ("2016-12-27", "Christmas Day (observed)"),
        )

    def test_2017_public_holidays(self):
        # https://dominicaconsulategreece.com/dominica/public-holidays/
        self.assertHolidaysInYear(
            2017,
            ("2017-01-01", "New Year's Day"),
            ("2017-01-02", "New Year's Day (observed)"),
            ("2017-02-27", "Carnival Monday"),
            ("2017-02-28", "Carnival Tuesday"),
            ("2017-04-14", "Good Friday"),
            ("2017-04-17", "Easter Monday"),
            ("2017-05-01", "Labour Day"),
            ("2017-06-05", "Whit Monday"),
            ("2017-08-07", "Emancipation Day"),
            ("2017-11-03", "Independence Day"),
            ("2017-11-04", "National Day of Community Service"),
            ("2017-12-25", "Christmas Day"),
            ("2017-12-26", "Boxing Day"),
        )

    def test_2018_public_holidays(self):
        # https://dominicaconsulategreece.com/dominica/public-holidays/
        self.assertHolidaysInYear(
            2018,
            ("2018-01-01", "New Year's Day"),
            ("2018-02-12", "Carnival Monday"),
            ("2018-02-13", "Carnival Tuesday"),
            ("2018-03-30", "Good Friday"),
            ("2018-04-02", "Easter Monday"),
            ("2018-05-07", "Labour Day"),
            ("2018-05-21", "Whit Monday"),
            ("2018-08-06", "Emancipation Day"),
            ("2018-11-03", "Independence Day"),
            ("2018-11-04", "National Day of Community Service"),
            ("2018-11-05", "National Day of Community Service (observed)"),
            ("2018-12-25", "Christmas Day"),
            ("2018-12-26", "Boxing Day"),
        )

    def test_2019_public_holidays(self):
        # https://dominicaconsulategreece.com/dominica/public-holidays/
        self.assertHolidaysInYear(
            2019,
            ("2019-01-01", "New Year's Day"),
            ("2019-03-04", "Carnival Monday"),
            ("2019-03-05", "Carnival Tuesday"),
            ("2019-04-19", "Good Friday"),
            ("2019-04-22", "Easter Monday"),
            ("2019-05-06", "Labour Day"),
            ("2019-06-10", "Whit Monday"),
            ("2019-08-05", "Emancipation Day"),
            ("2019-09-19", "Post-Hurricane Maria Thanksgiving Celebrations"),
            ("2019-11-03", "Independence Day"),
            ("2019-11-04", "National Day of Community Service"),
            ("2019-11-05", "Independence Day (observed)"),
            ("2019-12-25", "Christmas Day"),
            ("2019-12-26", "Boxing Day"),
        )

    def test_2020_public_holidays(self):
        # https://dominicaconsulategreece.com/dominica/public-holidays/
        self.assertHolidaysInYear(
            2020,
            ("2020-01-01", "New Year's Day"),
            ("2020-02-24", "Carnival Monday"),
            ("2020-02-25", "Carnival Tuesday"),
            ("2020-04-10", "Good Friday"),
            ("2020-04-13", "Easter Monday"),
            ("2020-05-04", "Labour Day"),
            ("2020-06-01", "Whit Monday"),
            ("2020-08-03", "Emancipation Day"),
            ("2020-11-03", "Independence Day"),
            ("2020-11-04", "National Day of Community Service"),
            ("2020-12-25", "Christmas Day"),
            ("2020-12-26", "Boxing Day"),
        )

    def test_2021_public_holidays(self):
        # http://www.q95da.com/news/q95-news-received-on-december-29-2020-at-731pm-the-official-public-holiday-calendar-for-2021-approved-by-the-government-of-dominica
        self.assertHolidaysInYear(
            2021,
            ("2021-01-01", "New Year's Day"),
            ("2021-02-15", "Carnival Monday"),
            ("2021-02-16", "Carnival Tuesday"),
            ("2021-04-02", "Good Friday"),
            ("2021-04-05", "Easter Monday"),
            ("2021-05-03", "Labour Day"),
            ("2021-05-24", "Whit Monday"),
            ("2021-08-02", "Emancipation Day"),
            ("2021-11-03", "Independence Day"),
            ("2021-11-04", "National Day of Community Service"),
            ("2021-12-25", "Christmas Day"),
            ("2021-12-26", "Boxing Day"),
            ("2021-12-27", "Boxing Day (observed)"),
        )

    def test_2022_public_holidays(self):
        # https://dominica.gov.dm/about-dominica/public-holidays
        self.assertHolidaysInYear(
            2022,
            ("2022-01-01", "New Year's Day"),
            ("2022-02-28", "Carnival Monday"),
            ("2022-03-01", "Carnival Tuesday"),
            ("2022-04-15", "Good Friday"),
            ("2022-04-18", "Easter Monday"),
            ("2022-05-02", "Labour Day"),
            ("2022-06-06", "Whit Monday"),
            ("2022-08-01", "Emancipation Day"),
            ("2022-11-03", "Independence Day"),
            ("2022-11-04", "National Day of Community Service"),
            ("2022-12-25", "Christmas Day"),
            ("2022-12-26", "Boxing Day"),
            ("2022-12-27", "Christmas Day (observed)"),
        )

    def test_2023_public_holidays(self):
        # https://dominica.gov.dm/about-dominica/public-holidays
        self.assertHolidaysInYear(
            2023,
            ("2023-01-01", "New Year's Day"),
            ("2023-01-02", "New Year's Day (observed)"),
            ("2023-02-20", "Carnival Monday"),
            ("2023-02-21", "Carnival Tuesday"),
            ("2023-04-07", "Good Friday"),
            ("2023-04-10", "Easter Monday"),
            ("2023-05-01", "Labour Day"),
            ("2023-05-29", "Whit Monday"),
            ("2023-08-07", "Emancipation Day"),
            ("2023-11-03", "Independence Day"),
            ("2023-11-04", "National Day of Community Service"),
            ("2023-12-25", "Christmas Day"),
            ("2023-12-26", "Boxing Day"),
        )

    def test_2024_public_holidays(self):
        # https://dominica.gov.dm/about-dominica/public-holidays
        self.assertHolidaysInYear(
            2024,
            ("2024-01-01", "New Year's Day"),
            ("2024-02-12", "Carnival Monday"),
            ("2024-02-13", "Carnival Tuesday"),
            ("2024-03-29", "Good Friday"),
            ("2024-04-01", "Easter Monday"),
            ("2024-05-06", "Labour Day"),
            ("2024-05-20", "Whit Monday"),
            ("2024-08-05", "Emancipation Day"),
            ("2024-11-03", "Independence Day"),
            ("2024-11-04", "National Day of Community Service"),
            ("2024-11-05", "Independence Day (observed)"),
            ("2024-12-25", "Christmas Day"),
            ("2024-12-26", "Boxing Day"),
        )