Exemple #1
0
    def test_intervals(self):
        """ Basic intervals tests. """

        self.assertEquals(
            datetime.datetime(2000, 12, 3, 10, 10, 1, 0, pytz.utc),
            every_minute(datetime.datetime(2000, 12, 3, 10, 10, 10, 0, pytz.utc)))

        self.assertEquals(
            datetime.datetime(2000, 12, 3, 10, 1, 1, 0, pytz.utc),
            hourly(datetime.datetime(2000, 12, 3, 10, 10, 10, 0, pytz.utc)))

#
# Daily or less often
#
        self.assertEquals(
            datetime.date(2000, 12, 3),
            daily(datetime.date(2000, 12, 3)))

        self.assertEquals(
            # 2000-11-27 was a Monday
            datetime.date(2000, 11, 27),
            weekly(datetime.date(2000, 12, 3)))

        self.assertEquals(
            datetime.date(2000, 12, 1),
            biweekly(datetime.date(2000, 12, 12)))

        self.assertEquals(
            datetime.date(2000, 12, 15),
            biweekly(datetime.date(2000, 12, 16)))

        self.assertEquals(
            datetime.date(2000, 12, 1),
            monthly(datetime.date(2000, 12, 12)))

        self.assertEquals(
            datetime.date(2000, 12, 1),
            monthly(datetime.date(2000, 12, 12)))

        self.assertEquals(
            datetime.date(2000, 10, 1),
            quarterly(datetime.date(2000, 12, 12)))

        self.assertEquals(
            datetime.date(2000, 7, 1),
            semiyearly(datetime.date(2000, 12, 12)))

        self.assertEquals(
            datetime.date(2000, 1, 1),
            yearly(datetime.date(2000, 12, 12)))
Exemple #2
0
    def test_intervals(self):
        """ Basic intervals tests. """

        self.assertEquals(
            datetime.datetime(2000, 12, 3, 10, 10, 1, 0, pytz.utc),
            every_minute(
                datetime.datetime(2000, 12, 3, 10, 10, 10, 0, pytz.utc)))

        self.assertEquals(
            datetime.datetime(2000, 12, 3, 10, 1, 1, 0, pytz.utc),
            hourly(datetime.datetime(2000, 12, 3, 10, 10, 10, 0, pytz.utc)))

        #
        # Daily or less often
        #
        self.assertEquals(datetime.date(2000, 12, 3),
                          daily(datetime.date(2000, 12, 3)))

        self.assertEquals(
            # 2000-11-27 was a Monday
            datetime.date(2000, 11, 27),
            weekly(datetime.date(2000, 12, 3)))

        self.assertEquals(datetime.date(2000, 12, 1),
                          biweekly(datetime.date(2000, 12, 12)))

        self.assertEquals(datetime.date(2000, 12, 15),
                          biweekly(datetime.date(2000, 12, 16)))

        self.assertEquals(datetime.date(2000, 12, 1),
                          monthly(datetime.date(2000, 12, 12)))

        self.assertEquals(datetime.date(2000, 12, 1),
                          monthly(datetime.date(2000, 12, 12)))

        self.assertEquals(datetime.date(2000, 10, 1),
                          quarterly(datetime.date(2000, 12, 12)))

        self.assertEquals(datetime.date(2000, 7, 1),
                          semiyearly(datetime.date(2000, 12, 12)))

        self.assertEquals(datetime.date(2000, 1, 1),
                          yearly(datetime.date(2000, 12, 12)))
Exemple #3
0
 def closest(self):
     return yearly(self.date)