https://github.com/python/cpython/commit/f81f1bb2f9f522d5295a38d120b29b66c9e3d5c2
commit: f81f1bb2f9f522d5295a38d120b29b66c9e3d5c2
branch: 3.13
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: serhiy-storchaka <storch...@gmail.com>
date: 2025-05-15T07:45:00Z
summary:

[3.13] Test also error messages in test_limit_int. (GH-134018) (GH-134032)

(cherry picked from commit e123a1d09bcb75aae0c53d9d732de5d9a1252efe)

Co-authored-by: Serhiy Storchaka <storch...@gmail.com>

files:
M Lib/test/test_fractions.py

diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index 720513a2d36c09..0cf789899b7b7e 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -462,22 +462,23 @@ def check_invalid(s):
     def test_limit_int(self):
         maxdigits = 5000
         with adjust_int_max_str_digits(maxdigits):
+            msg = 'Exceeds the limit'
             val = '1' * maxdigits
             num = (10**maxdigits - 1)//9
             self.assertEqual((num, 1), _components(F(val)))
-            self.assertRaises(ValueError, F, val + '1')
+            self.assertRaisesRegex(ValueError, msg, F, val + '1')
             self.assertEqual((num, 2), _components(F(val + '/2')))
-            self.assertRaises(ValueError, F, val + '1/2')
+            self.assertRaisesRegex(ValueError, msg, F, val + '1/2')
             self.assertEqual((1, num), _components(F('1/' + val)))
-            self.assertRaises(ValueError, F, '1/1' + val)
+            self.assertRaisesRegex(ValueError, msg, F, '1/1' + val)
             self.assertEqual(((10**(maxdigits+1) - 1)//9, 10**maxdigits),
                              _components(F('1.' + val)))
-            self.assertRaises(ValueError, F, '1.1' + val)
+            self.assertRaisesRegex(ValueError, msg, F, '1.1' + val)
             self.assertEqual((num, 10**maxdigits), _components(F('.' + val)))
-            self.assertRaises(ValueError, F, '.1' + val)
-            self.assertRaises(ValueError, F, '1.1e1' + val)
+            self.assertRaisesRegex(ValueError, msg, F, '.1' + val)
+            self.assertRaisesRegex(ValueError, msg, F, '1.1e1' + val)
             self.assertEqual((11, 10), _components(F('1.1e' + '0' * 
maxdigits)))
-            self.assertRaises(ValueError, F, '1.1e' + '0' * (maxdigits+1))
+            self.assertRaisesRegex(ValueError, msg, F, '1.1e' + '0' * 
(maxdigits+1))
 
     def testImmutable(self):
         r = F(7, 3)

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to