def test_strptime_with_utc(self): dt = RichDateTime.strptime('20001231045607', '%Y%m%d%H%M%S', self.utc) self.assertEqual(dt, datetime(2000, 12, 31, 4, 56, 7, tzinfo=self.utc)) self.assertEqual(dt.tzinfo, self.utc)
def test_strptime_with_specified_timezone(self): dt = RichDateTime.strptime('20001231045607', '%Y%m%d%H%M%S', self.jst) self.assertEqual(dt, datetime(2000, 12, 31, 4, 56, 7, tzinfo=self.jst)) self.assertEqual(dt.tzinfo, self.jst)
def test_strptime_without_tzinfo(self): dt = RichDateTime.strptime('20001231045607', '%Y%m%d%H%M%S') self.assertEqual(dt, datetime(2000, 12, 31, 4, 56, 7, tzinfo=tzlocal())) self.assertEqual(dt.tzinfo, tzlocal())