Beispiel #1
0
    def test_to_date(self):
        self.assertEquals(to_date('March 4, 2011', '%B %d, %Y'),
                          datetime.date(2011, 3, 4))

        # test no year in parse format
        test_date = to_date('March 4', '%B %d')
        self.assertEquals(test_date.year, datetime.datetime.utcnow().year)
Beispiel #2
0
    def test_to_date(self):
        self.assertEquals(to_date('March 4, 2011', '%B %d, %Y'),
                          datetime.date(2011, 3, 4))

        # test no year in parse format
        test_date = to_date('March 4', '%B %d')
        self.assertEquals(test_date.year, datetime.datetime.utcnow().year)
Beispiel #3
0
    def test_localized_to_date(self):
        current_locale = locale.getlocale(locale.LC_TIME)

        self.assertEquals(
            to_date('11 janvier 2011', '%d %B %Y', locale='fr_FR.UTF-8'),
            datetime.date(2011, 1, 11))

        self.assertEquals(current_locale, locale.getlocale(locale.LC_TIME))
Beispiel #4
0
    def test_localized_to_date(self):
        current_locale = locale.getlocale(locale.LC_ALL)

        self.assertEquals(
            to_date('11 janvier 2011', '%d %B %Y', locale='fr_FR.UTF-8'),
            datetime.date(2011, 1, 11)
        )

        self.assertEquals(current_locale, locale.getlocale(locale.LC_ALL))