gh-83861: Fix datetime.astimezone() method (GH-101545)

This commit is contained in:
Alexander Belopolsky 2023-04-19 17:02:29 -04:00 committed by GitHub
parent d4aa8578b1
commit 2b1260c557
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 2 deletions

View file

@ -6212,6 +6212,10 @@ class ZoneInfoTest(unittest.TestCase):
ts1 = dt.replace(fold=1).timestamp()
self.assertEqual(ts0, s0 + ss / 2)
self.assertEqual(ts1, s0 - ss / 2)
# gh-83861
utc0 = dt.astimezone(timezone.utc)
utc1 = dt.replace(fold=1).astimezone(timezone.utc)
self.assertEqual(utc0, utc1 + timedelta(0, ss))
finally:
if TZ is None:
del os.environ['TZ']