示例#1
0
 def test_parse_tz(self):
     self.assertEqual(
         datetime(2014, 3, 11, 14, 12, tzinfo=_UTCOffset(330)),
         parse_datetime("201403111412+0530"),
     )
     self.assertEqual(
         datetime(2014, 3, 11, 14, 12, 20, tzinfo=_UTCOffset(-300)),
         parse_datetime("20140311141220-0500"),
     )
示例#2
0
 def test_parse_datetime_frac(self):
     self.assertEqual(
         datetime(2014, 3, 11, 14, 25, 33, 100000),
         parse_datetime("20140311142533.1"),
     )
     self.assertEqual(
         datetime(2014, 3, 11, 14, 25, 33, 10000),
         parse_datetime("20140311142533.01"),
     )
     self.assertEqual(
         datetime(2014, 3, 11, 14, 25, 33, 1000),
         parse_datetime("20140311142533.001"),
     )
     self.assertEqual(
         datetime(2014, 3, 11, 14, 25, 33, 100),
         parse_datetime("20140311142533.0001"),
     )
示例#3
0
 def test_parse_date(self):
     self.assertEqual(datetime(1901, 2, 13), parse_datetime("19010213"))
示例#4
0
 def test_parse_datetime(self):
     self.assertEqual(datetime(2014, 3, 11, 14, 25, 33),
                      parse_datetime("20140311142533"))
示例#5
0
 def test_parse_date(self):
     self.assertEqual(datetime(1901, 2, 13), parse_datetime("19010213"))
示例#6
0
 def test_parse_tz(self):
     self.assertEqual(datetime(2014, 3, 11, 14, 12, tzinfo=_UTCOffset(330)), parse_datetime("201403111412+0530"))
     self.assertEqual(datetime(2014, 3, 11, 14, 12, 20, tzinfo=_UTCOffset(-300)), parse_datetime("20140311141220-0500"))
示例#7
0
 def test_parse_datetime_frac(self):
     self.assertEqual(datetime(2014, 3, 11, 14, 25, 33, 100000), parse_datetime("20140311142533.1"))
     self.assertEqual(datetime(2014, 3, 11, 14, 25, 33, 10000), parse_datetime("20140311142533.01"))
     self.assertEqual(datetime(2014, 3, 11, 14, 25, 33, 1000), parse_datetime("20140311142533.001"))
     self.assertEqual(datetime(2014, 3, 11, 14, 25, 33, 100), parse_datetime("20140311142533.0001"))
示例#8
0
 def test_parse_datetime(self):
     self.assertEqual(datetime(2014, 3, 11, 14, 25, 33), parse_datetime("20140311142533"))