File: test_lesotho.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 (60 lines) | stat: -rw-r--r-- 2,445 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
#  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.lesotho import Lesotho
from tests.common import CommonCountryTests


class TestLesotho(CommonCountryTests, TestCase):
    @classmethod
    def setUpClass(cls):
        super().setUpClass(Lesotho, years=range(1996, 2040))

    def test_special_holidays(self):
        self.assertHoliday("2002-05-25")

    def test_heroes_day(self):
        name = "Heroes Day"
        self.assertHolidayName(name, (f"{year}-04-04" for year in range(1996, 2003)))
        self.assertNoHolidayName(name, range(2003, 2040))
        self.assertNoHoliday(f"{year}-04-04" for year in range(2003, 2040))

    def test_africa_heroes_day(self):
        name = "Africa/Heroes Day"
        self.assertHolidayName(name, (f"{year}-05-25" for year in range(2003, 2040)))
        self.assertNoHolidayName(name, range(1996, 2003))
        self.assertNoHoliday(f"{year}-05-25" for year in range(1996, 2002))

    def test_kings_birthday(self):
        name = "King's Birthday"
        self.assertHolidayName(name, (f"{year}-05-02" for year in range(1996, 1998)))
        self.assertHolidayName(name, (f"{year}-07-17" for year in range(1998, 2040)))
        self.assertNoHoliday(f"{year}-05-02" for year in range(1998, 2040))
        self.assertNoHoliday(f"{year}-07-17" for year in range(1996, 1998))

    def test_2022(self):
        self.assertHolidaysInYear(
            2022,
            ("2022-01-01", "New Year's Day"),
            ("2022-03-11", "Moshoeshoe's Day"),
            ("2022-04-15", "Good Friday"),
            ("2022-04-18", "Easter Monday"),
            ("2022-05-01", "Workers' Day"),
            ("2022-05-25", "Africa/Heroes Day"),
            ("2022-05-26", "Ascension Day"),
            ("2022-07-17", "King's Birthday"),
            ("2022-10-04", "Independence Day"),
            ("2022-12-25", "Christmas Day"),
            ("2022-12-26", "Boxing Day"),
        )