Skip to content

Commit 1d0c65f

Browse files
committed
gh-148658: Add test for negative timestamp DST handling
1 parent 7398f51 commit 1d0c65f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Lib/test/datetimetester.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5661,6 +5661,15 @@ def test_astimezone_default_near_fold(self):
56615661
s = t.astimezone()
56625662
self.assertEqual(t.tzinfo, s.tzinfo)
56635663

5664+
@unittest.skipIf(sys.platform != "win32", "gh-148658 only affects Windows")
5665+
def test_astimezone_negative_timestamp_dst(self):
5666+
# gh-148658: astimezone() returned DST name for negative timestamps
5667+
# on Windows. Verify that the timezone name is consistent between
5668+
# negative and non-negative timestamps.
5669+
dt_neg1 = self.theclass.fromtimestamp(-1).astimezone()
5670+
dt_zero = self.theclass.fromtimestamp(0).astimezone()
5671+
self.assertEqual(dt_neg1.tzname(), dt_zero.tzname())
5672+
56645673
def test_aware_subtract(self):
56655674
cls = self.theclass
56665675

0 commit comments

Comments
 (0)