File: test_pitcairn_islands.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 (137 lines) | stat: -rw-r--r-- 4,606 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
#  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.constants import GOVERNMENT, WORKDAY
from holidays.countries.pitcairn_islands import PitcairnIslands
from tests.common import CommonCountryTests


class TestPitcairnIslands(CommonCountryTests, TestCase):
    @classmethod
    def setUpClass(cls):
        years = range(2016, 2050)
        super().setUpClass(PitcairnIslands, years=years)
        cls.government_holidays = PitcairnIslands(categories=GOVERNMENT, years=years)
        cls.workday_holidays = PitcairnIslands(categories=WORKDAY, years=years)

    def test_new_years_day(self):
        name = "New Year's Day"
        # Public Holidays.
        self.assertHolidayName(name, (f"{year}-01-01" for year in range(2016, 2050)))
        # Government Holidays.
        self.assertHolidayName(
            name, self.government_holidays, (f"{year}-01-02" for year in range(2016, 2050))
        )
        self.assertNoHolidayName(name, (f"{year}-01-02" for year in range(2016, 2050)))

    def test_bounty_day(self):
        self.assertHolidayName("Bounty Day", (f"{year}-01-23" for year in range(2016, 2050)))

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

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

    def test_queens_birthday(self):
        name = "Queen's Birthday"
        self.assertHolidayName(
            name,
            "2016-06-11",
            "2017-06-10",
            "2018-06-09",
            "2019-06-08",
            "2020-06-13",
            "2021-06-12",
            "2022-06-11",
        )
        self.assertNoHolidayName(name, range(2023, 2050))

    def test_kings_birthday(self):
        name = "King's Birthday"
        self.assertHolidayName(
            name,
            "2023-06-05",
            "2024-06-03",
            "2025-06-02",
        )
        self.assertHolidayName(name, range(2023, 2050))
        self.assertNoHolidayName(name, range(2016, 2023))

    def test_pitcairn_day(self):
        self.assertHolidayName("Pitcairn Day", (f"{year}-07-02" for year in range(2016, 2050)))

    def test_christmas_day(self):
        self.assertHolidayName("Christmas Day", (f"{year}-12-25" for year in range(2016, 2050)))

    def test_boxing_day(self):
        self.assertHolidayName("Boxing Day", (f"{year}-12-26" for year in range(2016, 2050)))

    def test_anzac_day(self):
        name = "ANZAC Day"
        self.assertNoHolidayName(name)
        self.assertHolidayName(
            name, self.workday_holidays, (f"{year}-04-25" for year in range(2016, 2050))
        )

    def test_remembrance_day(self):
        name = "Remembrance Day"
        self.assertNoHolidayName(name)
        self.assertHolidayName(
            name, self.workday_holidays, (f"{year}-11-11" for year in range(2016, 2050))
        )

    def test_2022_public(self):
        self.assertHolidaysInYear(
            2022,
            ("2022-01-01", "New Year's Day"),
            ("2022-01-23", "Bounty Day"),
            ("2022-04-15", "Good Friday"),
            ("2022-04-18", "Easter Monday"),
            ("2022-06-11", "Queen's Birthday"),
            ("2022-07-02", "Pitcairn Day"),
            ("2022-12-25", "Christmas Day"),
            ("2022-12-26", "Boxing Day"),
        )

    def test_2022_government(self):
        self.assertGovernmentHolidaysInYear(
            2022,
            ("2022-01-02", "New Year's Day"),
        )

    def test_2022_workday(self):
        self.assertWorkdayHolidaysInYear(
            2022,
            ("2022-04-25", "ANZAC Day"),
            ("2022-11-11", "Remembrance Day"),
        )