Example #1
0
    def test_weekday(self):

        with self.settings(LANGUAGE_CODE='en-us'):
            self.assertEqual(get_weekday(), 6)

        with self.settings(LANGUAGE_CODE='fr-fr'):
            self.assertEqual(get_weekday(), 0)

        with self.settings(LANGUAGE_CODE='fa'):
            self.assertEqual(get_weekday(), 5)
Example #2
0
    def __init__(self, date_min, date_max, granularity):

        if date_min >= date_max:
            raise InvalidDateRanges("Date min could not be greater or equals "
                                    "than date max.")
        self.date_min = date_min
        self.date_max = date_max

        if granularity not in (GRANULARITY_MONTH, GRANULARITY_WEEK):
            raise UnknownGranularity('Unknow granularity: %s' % granularity)
        self.granularity = granularity

        self.week_day = get_weekday()
Example #3
0
    def __init__(self, date_min, date_max, granularity):

        if date_min >= date_max:
            raise InvalidDateRanges("Date min could not be greater or equals "
                                    "than date max.")
        self.date_min = date_min
        self.date_max = date_max

        if granularity not in (GRANULARITY_MONTH, GRANULARITY_WEEK):
            raise UnknownGranularity('Unknow granularity: %s' % granularity)
        self.granularity = granularity

        self.week_day = get_weekday()