Close #15165: Fix test_email on Windows 64 bits
Use year 1990 instead of year 1970 to avoid issues with negative timestamps.
This commit is contained in:
parent
519f43844b
commit
9d95cbeaf9
|
@ -91,7 +91,7 @@ class LocaltimeTests(unittest.TestCase):
|
||||||
@test.support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0')
|
@test.support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0')
|
||||||
def test_localtime_epoch_utc_daylight_true(self):
|
def test_localtime_epoch_utc_daylight_true(self):
|
||||||
test.support.patch(self, time, 'daylight', True)
|
test.support.patch(self, time, 'daylight', True)
|
||||||
t0 = datetime.datetime(1970, 1, 1, tzinfo = datetime.timezone.utc)
|
t0 = datetime.datetime(1990, 1, 1, tzinfo = datetime.timezone.utc)
|
||||||
t1 = utils.localtime(t0)
|
t1 = utils.localtime(t0)
|
||||||
t2 = t0 - datetime.timedelta(hours=5)
|
t2 = t0 - datetime.timedelta(hours=5)
|
||||||
t2 = t2.replace(tzinfo = datetime.timezone(datetime.timedelta(hours=-5)))
|
t2 = t2.replace(tzinfo = datetime.timezone(datetime.timedelta(hours=-5)))
|
||||||
|
@ -100,7 +100,7 @@ class LocaltimeTests(unittest.TestCase):
|
||||||
@test.support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0')
|
@test.support.run_with_tz('EST+05EDT,M3.2.0,M11.1.0')
|
||||||
def test_localtime_epoch_utc_daylight_false(self):
|
def test_localtime_epoch_utc_daylight_false(self):
|
||||||
test.support.patch(self, time, 'daylight', False)
|
test.support.patch(self, time, 'daylight', False)
|
||||||
t0 = datetime.datetime(1970, 1, 1, tzinfo = datetime.timezone.utc)
|
t0 = datetime.datetime(1990, 1, 1, tzinfo = datetime.timezone.utc)
|
||||||
t1 = utils.localtime(t0)
|
t1 = utils.localtime(t0)
|
||||||
t2 = t0 - datetime.timedelta(hours=5)
|
t2 = t0 - datetime.timedelta(hours=5)
|
||||||
t2 = t2.replace(tzinfo = datetime.timezone(datetime.timedelta(hours=-5)))
|
t2 = t2.replace(tzinfo = datetime.timezone(datetime.timedelta(hours=-5)))
|
||||||
|
@ -108,14 +108,14 @@ class LocaltimeTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_localtime_epoch_notz_daylight_true(self):
|
def test_localtime_epoch_notz_daylight_true(self):
|
||||||
test.support.patch(self, time, 'daylight', True)
|
test.support.patch(self, time, 'daylight', True)
|
||||||
t0 = datetime.datetime(1970, 1, 1)
|
t0 = datetime.datetime(1990, 1, 1)
|
||||||
t1 = utils.localtime(t0)
|
t1 = utils.localtime(t0)
|
||||||
t2 = utils.localtime(t0.replace(tzinfo=None))
|
t2 = utils.localtime(t0.replace(tzinfo=None))
|
||||||
self.assertEqual(t1, t2)
|
self.assertEqual(t1, t2)
|
||||||
|
|
||||||
def test_localtime_epoch_notz_daylight_false(self):
|
def test_localtime_epoch_notz_daylight_false(self):
|
||||||
test.support.patch(self, time, 'daylight', False)
|
test.support.patch(self, time, 'daylight', False)
|
||||||
t0 = datetime.datetime(1970, 1, 1)
|
t0 = datetime.datetime(1990, 1, 1)
|
||||||
t1 = utils.localtime(t0)
|
t1 = utils.localtime(t0)
|
||||||
t2 = utils.localtime(t0.replace(tzinfo=None))
|
t2 = utils.localtime(t0.replace(tzinfo=None))
|
||||||
self.assertEqual(t1, t2)
|
self.assertEqual(t1, t2)
|
||||||
|
|
Loading…
Reference in New Issue