Skip to content

Commit f9d468c

Browse files
committed
update tests
1 parent 00e3b45 commit f9d468c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/test/datetimetester.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2699,7 +2699,7 @@ def test_timestamp_limits(self):
26992699
with self.subTest("maximum UTC"):
27002700
# Zero out microseconds to avoid rounding issues
27012701
max_dt = self.theclass.max.replace(tzinfo=timezone.utc,
2702-
microsecond=0)
2702+
microsecond=0, nanosecond=0)
27032703
max_ts = max_dt.timestamp()
27042704

27052705
# This test assumes that datetime.max == 9999-12-31T23:59:59.999999
@@ -2717,9 +2717,9 @@ def test_fromtimestamp_limits(self):
27172717
min_dt = self.theclass.min + timedelta(days=1)
27182718
min_ts = min_dt.timestamp()
27192719

2720-
max_dt = self.theclass.max.replace(microsecond=0)
2721-
max_ts = ((self.theclass.max - timedelta(hours=23)).timestamp() +
2722-
timedelta(hours=22, minutes=59, seconds=59).total_seconds())
2720+
max_dt = self.theclass.max.replace(microsecond=0, nanosecond=0)
2721+
max_ts = ((max_dt - timedelta(hours=23)).timestamp() +
2722+
timedelta(hours=23).total_seconds())
27232723

27242724
for (test_name, ts, expected) in [
27252725
("minimum", min_ts, min_dt),
@@ -2755,7 +2755,7 @@ def test_utcfromtimestamp_limits(self):
27552755
min_dt = self.theclass.min.replace(tzinfo=timezone.utc)
27562756
min_ts = min_dt.timestamp()
27572757

2758-
max_dt = self.theclass.max.replace(microsecond=0, tzinfo=timezone.utc)
2758+
max_dt = self.theclass.max.replace(microsecond=0, nanosecond=0, tzinfo=timezone.utc)
27592759
max_ts = max_dt.timestamp()
27602760

27612761
for (test_name, ts, expected) in [

0 commit comments

Comments
 (0)