File: test_antarctica.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 (50 lines) | stat: -rw-r--r-- 1,847 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
#  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 calendar import isleap
from unittest import TestCase

from holidays.countries.antarctica import Antarctica
from tests.common import CommonCountryTests


class TestAntarctica(CommonCountryTests, TestCase):
    @classmethod
    def setUpClass(cls):
        super().setUpClass(Antarctica)

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

    def test_midwinter_day(self):
        self.assertHolidayName(
            "Midwinter Day",
            (f"{year}-06-20" for year in self.full_range if isleap(year)),
            (f"{year}-06-21" for year in self.full_range if not isleap(year)),
        )

    def test_antarctica_day(self):
        name = "Antarctica Day"
        self.assertHolidayName(name, (f"{year}-12-01" for year in range(2010, self.end_year)))
        self.assertNoHolidayName(name, range(self.start_year, 2010))

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

    def test_2025(self):
        self.assertHolidaysInYear(
            2025,
            ("2025-01-01", "New Year's Day"),
            ("2025-06-21", "Midwinter Day"),
            ("2025-12-01", "Antarctica Day"),
            ("2025-12-25", "Christmas Day"),
        )