Exemple #1
0
    def test_holiday_list_acces_and_modification(self):

        ukcal = UnitedKingdom()

        holidays = list(holiday_list(ukcal, Date(1, Jan, 2011), Date(31, 12, 2011)))
        self.assertEquals(UK_HOLIDAYS_2011, len(holidays))

        new_holiday_date = Date(23, August, 2011)

        ukcal.add_holiday(new_holiday_date)

        holidays = list(holiday_list(ukcal, Date(1, Jan, 2011), Date(31, 12, 2011)))
        self.assertEquals(UK_HOLIDAYS_2011 + 1, len(holidays))

        ukcal.remove_holiday(new_holiday_date)

        holidays = list(holiday_list(ukcal, Date(1, Jan, 2011), Date(31, 12, 2011)))
        self.assertEquals(UK_HOLIDAYS_2011, len(holidays))
Exemple #2
0
    def test_holiday_list_acces_and_modification(self):

        ukcal = UnitedKingdom()

        holidays = list(
            holiday_list(ukcal, Date(1, Jan, 2011), Date(31, 12, 2011)))
        self.assertEquals(UK_HOLIDAYS_2011, len(holidays))

        new_holiday_date = Date(23, August, 2011)

        ukcal.add_holiday(new_holiday_date)

        holidays = list(
            holiday_list(ukcal, Date(1, Jan, 2011), Date(31, 12, 2011)))
        self.assertEquals(UK_HOLIDAYS_2011 + 1, len(holidays))

        ukcal.remove_holiday(new_holiday_date)

        holidays = list(
            holiday_list(ukcal, Date(1, Jan, 2011), Date(31, 12, 2011)))
        self.assertEquals(UK_HOLIDAYS_2011, len(holidays))
Exemple #3
0
    def test_iteration_on_date_list(self):

        date_iterator = holiday_list(
            TARGET(), Date(1, Jan, 2000), Date(1, Jan, 2001)
        )

        holidays = [
            Date(21, Apr, 2000), Date(24, Apr, 2000),
            Date(1, May, 2000), Date(25, Dec, 2000),
            Date(26, Dec, 2000), Date(1, Jan, 2001)
        ]

        for date in date_iterator:
            self.assertIn(date, holidays)
Exemple #4
0
    def test_iteration_on_date_list(self):

        date_iterator = holiday_list(TARGET(), Date(1, Jan, 2000),
                                     Date(1, Jan, 2001))

        holidays = [
            Date(21, Apr, 2000),
            Date(24, Apr, 2000),
            Date(1, May, 2000),
            Date(25, Dec, 2000),
            Date(26, Dec, 2000),
            Date(1, Jan, 2001)
        ]

        for date in date_iterator:
            self.assertIn(date, holidays)