Skip to content

Commit 6840090

Browse files
committed
gh-152849: Use subTest in the overflow message test
1 parent a23c23f commit 6840090

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Lib/test/test_time.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,10 +1019,11 @@ def test_FromSecondsObject_float_overflow_message(self):
10191019
from _testinternalcapi import _PyTime_FromSecondsObject
10201020
for value in (float(PyTime_MAX), float(PyTime_MIN)):
10211021
for time_rnd, _ in ROUNDING_MODES:
1022-
with self.assertRaisesRegex(
1023-
OverflowError,
1024-
"timestamp out of range for C PyTime_t"):
1025-
_PyTime_FromSecondsObject(value, time_rnd)
1022+
with self.subTest(value=value, time_rnd=time_rnd):
1023+
with self.assertRaisesRegex(
1024+
OverflowError,
1025+
"timestamp out of range for C PyTime_t"):
1026+
_PyTime_FromSecondsObject(value, time_rnd)
10261027

10271028
def test_AsSecondsDouble(self):
10281029
from _testcapi import PyTime_AsSecondsDouble

0 commit comments

Comments
 (0)