def test_special_holidays(self):
        base_date = [datetime(2012, 5, 28)]
        holiday_1 = Holiday('One-Time', year=2012, month=5, day=28)
        holiday_2 = Holiday('Range', month=5, day=28,
                            start_date=datetime(2012, 1, 1),
                            end_date=datetime(2012, 12, 31),
                            offset=DateOffset(weekday=MO(1)))

        assert base_date == holiday_1.dates(self.start_date, self.end_date)
        assert base_date == holiday_2.dates(self.start_date, self.end_date)
Exemple #2
0
    def test_special_holidays(self):
        base_date = [datetime(2012, 5, 28)]
        holiday_1 = Holiday('One-Time', year=2012, month=5, day=28)
        holiday_2 = Holiday('Range', month=5, day=28,
                            start_date=datetime(2012, 1, 1),
                            end_date=datetime(2012, 12, 31),
                            offset=DateOffset(weekday=MO(1)))

        assert base_date == holiday_1.dates(self.start_date, self.end_date)
        assert base_date == holiday_2.dates(self.start_date, self.end_date)
Exemple #3
0
    def test_special_holidays(self):
        base_date = [datetime(2012, 5, 28)]
        holiday_1 = Holiday("One-Time", year=2012, month=5, day=28)
        holiday_2 = Holiday(
            "Range",
            month=5,
            day=28,
            start_date=datetime(2012, 1, 1),
            end_date=datetime(2012, 12, 31),
            offset=DateOffset(weekday=MO(1)),
        )

        self.assertEqual(base_date, holiday_1.dates(self.start_date, self.end_date))
        self.assertEqual(base_date, holiday_2.dates(self.start_date, self.end_date))
Exemple #4
0
 def test_non_observed_holiday(self):
     july_3rd = Holiday('July 4th Eve', month=7,  day=3)
     result = july_3rd.dates("2001-01-01", "2003-03-03")
     expected = [Timestamp('2001-07-03 00:00:00'),
                 Timestamp('2002-07-03 00:00:00')]
     self.assertEqual(list(result), expected)
     july_3rd = Holiday('July 4th Eve', month=7,  day=3, 
                        days_of_week=(0, 1, 2, 3))
     result = july_3rd.dates("2001-01-01", "2008-03-03")
     expected = [Timestamp('2001-07-03 00:00:00'),
                 Timestamp('2002-07-03 00:00:00'),
                 Timestamp('2003-07-03 00:00:00'),
                 Timestamp('2006-07-03 00:00:00'),
                 Timestamp('2007-07-03 00:00:00')]
     self.assertEqual(list(result), expected)
def test_special_holidays(name, kwargs):
    base_date = [datetime(2012, 5, 28)]
    holiday = Holiday(name, **kwargs)

    start_date = datetime(2011, 1, 1)
    end_date = datetime(2020, 12, 31)

    assert base_date == holiday.dates(start_date, end_date)