gh-119057: Use better error messages for zero division (#119066)

This commit is contained in:
Nikita Sobolev 2024-06-03 19:03:56 +03:00 committed by GitHub
parent 153b118b78
commit 1d4c2e4a87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 32 additions and 20 deletions

View file

@ -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)