Esempio n. 1
0
    def test_class(self):
        h = holidays.Holidays()
        assert h.year == datetime.now().year
        assert str(self.h) == 'Holidays(2015)'

        h.set_year(2010)
        assert h.year == 2010
Esempio n. 2
0
    def test_holidays(self):
        h = holidays.Holidays(2014)
        self.assertEqual(h.christmas, (2014, 12, 25))
        assert h.thanksgiving == (2014, 11, 27)
        assert h.indigenous_peoples_day == (2014, 10, 13)

        assert h.independence_day == (2014, 7, 4)

        assert self.h.christmas == (2015, 12, 25)
        assert self.h.christmas_eve == (2015, 12, 24)
        assert self.h.new_years == (2015, 1, 1)
        assert self.h.new_years_eve == (2015, 12, 31)
        assert self.h.valentines_day == (2015, 2, 14)
        assert self.h.halloween == (2015, 10, 31)
        assert self.h.mothers_day == (2015, 5, 10)
        self.assertEqual(self.h.fathers_day, (2015, 6, 21))
Esempio n. 3
0
    def test_islamic_holidays(self):
        """Test the dates of certain Islamic holidays."""
        holidays_2015 = {
            'eid_aladha': (2015, 9, 24),
            'ramadan': (2015, 6, 18),
            'eid_alfitr': (2015, 7, 18),
        }
        with self.subTest():
            for name, date in holidays_2015.items():
                self.assertEqual(getattr(self.h, name), date, name)

        h21 = holidays.Holidays(2021)
        holidays_2021 = {
            'eid_aladha': (2021, 7, 20),
            'ramadan': (2021, 4, 13),
            'eid_alfitr': (2021, 5, 13),
        }
        with self.subTest():
            for name, date in holidays_2021.items():
                self.assertEqual(getattr(h21, name), date, name)
Esempio n. 4
0
 def setUp(self):
     self.h = holidays.Holidays(2015)