GH-90829: Fix empty iterable error message in min/max (#31181)

This commit is contained in:
Nnarol 2023-01-08 14:51:20 +01:00 committed by GitHub
parent b034fd3e59
commit 0741da8d28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -1155,7 +1155,11 @@ class BuiltinTest(unittest.TestCase):
max()
self.assertRaises(TypeError, max, 42)
self.assertRaises(ValueError, max, ())
with self.assertRaisesRegex(
ValueError,
r'max\(\) iterable argument is empty'
):
max(())
class BadSeq:
def __getitem__(self, index):
raise ValueError
@ -1214,7 +1218,11 @@ class BuiltinTest(unittest.TestCase):
min()
self.assertRaises(TypeError, min, 42)
self.assertRaises(ValueError, min, ())
with self.assertRaisesRegex(
ValueError,
r'min\(\) iterable argument is empty'
):
min(())
class BadSeq:
def __getitem__(self, index):
raise ValueError