Ejemplo n.º 1
0
    def test_normalize_time(self):
        now = util.utcnow()
        first_args = dict(day=1,
                          hour=0,
                          minute=0,
                          second=0,
                          microsecond=0,
                          tzinfo=UTC)
        now_enc = now.replace(**first_args)
        two_weeks_ago = now - timedelta(14)
        short_format = now.date().isoformat()

        entries = [
            ('', now_enc),
            (now, now_enc),
            (now.date(), now_enc),
            (two_weeks_ago, two_weeks_ago.replace(**first_args)),
            (short_format, now_enc),
            ('2011-01-01T11:12:13.456Z', now_enc),
            ('2070-01-01T11:12:13.456Z', now_enc),
            ('10-10-10', now_enc),
            ('2011-10-13T.Z', now_enc),
        ]

        for entry in entries:
            in_, expected = entry
            self.assertEqual(normalized_time(in_), expected)
Ejemplo n.º 2
0
    def test_normalize_time(self):
        now = util.utcnow()
        first_args = dict(day=1, hour=0, minute=0, second=0,
                          microsecond=0, tzinfo=UTC)
        now_enc = now.replace(**first_args)
        two_weeks_ago = now - timedelta(14)
        short_format = now.date().isoformat()

        entries = [
            ('', now_enc),
            (now, now_enc),
            (now.date(), now_enc),
            (two_weeks_ago, two_weeks_ago.replace(**first_args)),
            (short_format, now_enc),
            ('2011-01-01T11:12:13.456Z', now_enc),
            ('2070-01-01T11:12:13.456Z', now_enc),
            ('10-10-10', now_enc),
            ('2011-10-13T.Z', now_enc),
        ]

        for entry in entries:
            in_, expected = entry
            self.assertEqual(normalized_time(in_), expected)
Ejemplo n.º 3
0
 def preparer(self, cstruct):
     return normalized_time(cstruct)
Ejemplo n.º 4
0
 def preparer(self, cstruct):
     return normalized_time(cstruct)