Пример #1
0
 def test_datetime(self):
     self.assertEqual(
         datetime.datetime(
             2001, 12, 25, 13, 59, 43, 770000, tzinfo=pytz.UTC),
         DateTimeParser('2001-12-25T13:59:43.77Z').datetime())
Пример #2
0
 def test_fractional_timezone_time(self):
     self.assertEqual(
         datetime.time(13, 59, 43, 770000, tzinfo=pytz.FixedOffset(60)),
         DateTimeParser('13:59:43.77+01:00').time())
Пример #3
0
 def test_numeric_offset(self):
     get_offset = lambda x: DateTimeParser(x).numeric_offset()
     self.assertEqual(pytz.FixedOffset(0), get_offset('+00:00'))
     self.assertEqual(pytz.FixedOffset(90), get_offset('+01:30'))
     self.assertEqual(pytz.FixedOffset(-150), get_offset('-02:30'))
Пример #4
0
 def test_fractional_utc_time(self):
     self.assertEqual(
         datetime.time(13, 59, 43, 880000, tzinfo=pytz.UTC),
         DateTimeParser('13:59:43.88Z').time())
Пример #5
0
 def test_utc_time(self):
     self.assertEqual(
         datetime.time(13, 59, 43, tzinfo=pytz.UTC),
         DateTimeParser('13:59:43Z').time())
Пример #6
0
 def test_fractional_naive_time(self):
     self.assertEqual(
         datetime.time(13, 59, 43, 880000),
         DateTimeParser('13:59:43.88').naive_time())
Пример #7
0
 def test_naive_time(self):
     self.assertEqual(
         datetime.time(13, 59, 43),
         DateTimeParser('13:59:43').naive_time())
Пример #8
0
 def test_date(self):
     self.assertEqual(
         datetime.date(2001, 12, 25),
         DateTimeParser('2001-12-25').date())