diff options
author | Chris Eibl <138194463+chris-eibl@users.noreply.github.com> | 2025-04-28 11:55:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-28 11:55:08 (GMT) |
commit | 11f457cf41beede182d7387080f35c73f8f4a46f (patch) | |
tree | 6f9070bc3b9fd0e3fe899ee5b9cdc700e0e14671 /Lib/test/test_int.py | |
parent | e577439803db15122af9b080103a5819cd38272f (diff) | |
download | cpython-11f457cf41beede182d7387080f35c73f8f4a46f.zip cpython-11f457cf41beede182d7387080f35c73f8f4a46f.tar.gz cpython-11f457cf41beede182d7387080f35c73f8f4a46f.tar.bz2 |
GH-114911: use time.perf_counter in Stopwatch (GH-131469)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_int.py')
-rw-r--r-- | Lib/test/test_int.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py index d1bf847..245528c 100644 --- a/Lib/test/test_int.py +++ b/Lib/test/test_int.py @@ -590,7 +590,7 @@ class IntStrDigitLimitsTests(unittest.TestCase): digits = 78_268 with ( support.adjust_int_max_str_digits(digits), - support.CPUStopwatch() as sw_convert): + support.Stopwatch() as sw_convert): huge_decimal = str(huge_int) self.assertEqual(len(huge_decimal), digits) # Ensuring that we chose a slow enough conversion to measure. @@ -605,7 +605,7 @@ class IntStrDigitLimitsTests(unittest.TestCase): with support.adjust_int_max_str_digits(int(.995 * digits)): with ( self.assertRaises(ValueError) as err, - support.CPUStopwatch() as sw_fail_huge): + support.Stopwatch() as sw_fail_huge): str(huge_int) self.assertIn('conversion', str(err.exception)) self.assertLessEqual(sw_fail_huge.seconds, sw_convert.seconds/2) @@ -615,7 +615,7 @@ class IntStrDigitLimitsTests(unittest.TestCase): extra_huge_int = int(f'0x{"c"*500_000}', base=16) # 602060 digits. with ( self.assertRaises(ValueError) as err, - support.CPUStopwatch() as sw_fail_extra_huge): + support.Stopwatch() as sw_fail_extra_huge): # If not limited, 8 seconds said Zen based cloud VM. str(extra_huge_int) self.assertIn('conversion', str(err.exception)) @@ -630,7 +630,7 @@ class IntStrDigitLimitsTests(unittest.TestCase): huge = '8'*digits with ( support.adjust_int_max_str_digits(digits), - support.CPUStopwatch() as sw_convert): + support.Stopwatch() as sw_convert): int(huge) # Ensuring that we chose a slow enough conversion to measure. # It takes 0.1 seconds on a Zen based cloud VM in an opt build. @@ -642,7 +642,7 @@ class IntStrDigitLimitsTests(unittest.TestCase): with support.adjust_int_max_str_digits(digits - 1): with ( self.assertRaises(ValueError) as err, - support.CPUStopwatch() as sw_fail_huge): + support.Stopwatch() as sw_fail_huge): int(huge) self.assertIn('conversion', str(err.exception)) self.assertLessEqual(sw_fail_huge.seconds, sw_convert.seconds/2) @@ -652,7 +652,7 @@ class IntStrDigitLimitsTests(unittest.TestCase): extra_huge = '7'*1_200_000 with ( self.assertRaises(ValueError) as err, - support.CPUStopwatch() as sw_fail_extra_huge): + support.Stopwatch() as sw_fail_extra_huge): # If not limited, 8 seconds in the Zen based cloud VM. int(extra_huge) self.assertIn('conversion', str(err.exception)) |