예제 #1
0
 def test_localtime_epoch_utc_daylight_true(self):
     test_support.patch(self, time, 'daylight', True)
     t0 = datetime.datetime(1990, 1, 1, tzinfo = datetime.timezone.utc)
     t1 = utils.localtime(t0)
     t2 = t0 - datetime.timedelta(hours=5)
     t2 = t2.replace(tzinfo = datetime.timezone(datetime.timedelta(hours=-5)))
     self.assertEqual(t1, t2)
예제 #2
0
 def test_localtime_epoch_utc_daylight_true(self):
     test_support.patch(self, time, 'daylight', True)
     t0 = datetime.datetime(1990, 1, 1, tzinfo=datetime.timezone.utc)
     t1 = utils.localtime(t0)
     t2 = t0 - datetime.timedelta(hours=5)
     t2 = t2.replace(tzinfo=datetime.timezone(datetime.timedelta(hours=-5)))
     self.assertEqual(t1, t2)
예제 #3
0
 def test_localtime_daylight_false_dst_true(self):
     test_support.patch(self, time, 'daylight', False)
     t0 = datetime.datetime(2012, 3, 12, 1, 1)
     t1 = utils.localtime(t0, isdst=1)
     t2 = utils.localtime(t1)
     self.assertEqual(t1, t2)
예제 #4
0
 def test_localtime_is_tz_aware_daylight_false(self):
     test_support.patch(self, time, 'daylight', False)
     t = utils.localtime()
     self.assertIsNot(t.tzinfo, None)
예제 #5
0
 def test_localtime_epoch_notz_daylight_false(self):
     test_support.patch(self, time, 'daylight', False)
     t0 = datetime.datetime(1990, 1, 1)
     t1 = utils.localtime(t0)
     t2 = utils.localtime(t0.replace(tzinfo=None))
     self.assertEqual(t1, t2)
예제 #6
0
 def test_localtime_daylight_false_dst_true(self):
     test_support.patch(self, time, 'daylight', False)
     t0 = datetime.datetime(2012, 3, 12, 1, 1)
     t1 = utils.localtime(t0, isdst=1)
     t2 = utils.localtime(t1)
     self.assertEqual(t1, t2)
예제 #7
0
 def test_localtime_is_tz_aware_daylight_false(self):
     test_support.patch(self, time, 'daylight', False)
     t = utils.localtime()
     self.assertIsNot(t.tzinfo, None)
예제 #8
0
 def test_localtime_epoch_notz_daylight_false(self):
     test_support.patch(self, time, 'daylight', False)
     t0 = datetime.datetime(1990, 1, 1)
     t1 = utils.localtime(t0)
     t2 = utils.localtime(t0.replace(tzinfo=None))
     self.assertEqual(t1, t2)