aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_fractions.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_fractions.py')
-rw-r--r--Lib/test/test_fractions.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index 37de3ad380e..96b3f305194 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -500,22 +500,23 @@ class FractionTest(unittest.TestCase):
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)