mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
gh-119057: Use better error messages for zero division (#119066)
This commit is contained in:
parent
153b118b78
commit
1d4c2e4a87
11 changed files with 32 additions and 20 deletions
|
@ -662,6 +662,16 @@ class BuiltinTest(unittest.TestCase):
|
|||
self.assertAlmostEqual(result[1], exp_result[1])
|
||||
|
||||
self.assertRaises(TypeError, divmod)
|
||||
self.assertRaisesRegex(
|
||||
ZeroDivisionError,
|
||||
"division by zero",
|
||||
divmod, 1, 0,
|
||||
)
|
||||
self.assertRaisesRegex(
|
||||
ZeroDivisionError,
|
||||
"division by zero",
|
||||
divmod, 0.0, 0,
|
||||
)
|
||||
|
||||
def test_eval(self):
|
||||
self.assertEqual(eval('1+1'), 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue