File: test_liberia.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 (120 lines) | stat: -rw-r--r-- 4,328 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
#  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.liberia import Liberia
from tests.common import CommonCountryTests


class TestLiberia(CommonCountryTests, TestCase):
    @classmethod
    def setUpClass(cls):
        super().setUpClass(Liberia, years=range(1957, 2050))

    def test_new_years_day(self):
        self.assertHolidayName("New Year's Day", (f"{year}-01-01" for year in range(1957, 2050)))

    def test_inauguration_day(self):
        years_after_election = {1960, 1964, 1968, 1972, 1976, 1986, 1998, 2006, 2012, 2018, 2024}
        years_not_after_election = set(range(1957, 2050)) - years_after_election
        name = "Inauguration Day"
        self.assertHolidayName(
            name,
            "2006-01-02",
            "2012-01-02",
            "2018-01-01",
            "2024-01-01",
        )
        self.assertHolidayName(name, years_after_election)
        self.assertNoHolidayName(name, years_not_after_election)

    def test_armed_forces_day(self):
        self.assertHolidayName("Armed Forces Day", (f"{year}-02-11" for year in range(1957, 2050)))

    def test_decoration_day(self):
        name = "Decoration Day"
        self.assertHolidayName(
            name,
            "2021-03-10",
            "2022-03-09",
            "2023-03-08",
            "2024-03-13",
            "2025-03-12",
        )
        self.assertHolidayName(name, range(1957, 2050))

    def test_jj_roberts_memorial_day(self):
        self.assertHolidayName(
            "J. J. Roberts Memorial Birthday", (f"{year}-03-15" for year in range(1957, 2050))
        )

    def test_fasting_and_prayer_day(self):
        name = "Fasting and Prayer Day"
        self.assertHolidayName(
            name,
            "2021-04-09",
            "2022-04-08",
            "2023-04-14",
            "2024-04-12",
            "2025-04-11",
        )
        self.assertHolidayName(name, range(1957, 2050))

    def test_national_unification_and_integration_day(self):
        name = "National Unification and Integration Day"
        self.assertHolidayName(name, (f"{year}-05-14" for year in range(1960, 2050)))
        self.assertNoHolidayName(name, range(1957, 1960))

    def test_independence_day(self):
        self.assertHolidayName("Independence Day", (f"{year}-07-26" for year in range(1957, 2050)))

    def test_national_flag_day(self):
        self.assertHolidayName(
            "National Flag Day", (f"{year}-08-24" for year in range(1957, 2050))
        )

    def test_thanksgiving_day(self):
        name = "Thanksgiving Day"
        self.assertHolidayName(
            name,
            "2021-11-04",
            "2022-11-03",
            "2023-11-02",
            "2024-11-07",
            "2025-11-06",
        )
        self.assertHolidayName(name, range(1957, 2050))

    def test_tubman_administration_goodwill_day(self):
        self.assertHolidayName(
            "Tubman Administration Goodwill Day", (f"{year}-11-29" for year in range(1957, 2050))
        )

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

    def test_2025(self):
        self.assertHolidaysInYear(
            2025,
            ("2025-01-01", "New Year's Day"),
            ("2025-02-11", "Armed Forces Day"),
            ("2025-03-12", "Decoration Day"),
            ("2025-03-15", "J. J. Roberts Memorial Birthday"),
            ("2025-04-11", "Fasting and Prayer Day"),
            ("2025-05-14", "National Unification and Integration Day"),
            ("2025-07-26", "Independence Day"),
            ("2025-08-24", "National Flag Day"),
            ("2025-11-06", "Thanksgiving Day"),
            ("2025-11-29", "Tubman Administration Goodwill Day"),
            ("2025-12-25", "Christmas Day"),
        )