diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2020-01-10 16:31:43 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@python.org> | 2020-01-10 16:31:43 (GMT) |
commit | abdc634f337ce4943cd7d13587936837aac2ecc9 (patch) | |
tree | 1cd9642117077a38a913992b7c287002f7a22485 /Lib | |
parent | c39b52f1527868c7ada9385669c38edf98858921 (diff) | |
download | cpython-abdc634f337ce4943cd7d13587936837aac2ecc9.zip cpython-abdc634f337ce4943cd7d13587936837aac2ecc9.tar.gz cpython-abdc634f337ce4943cd7d13587936837aac2ecc9.tar.bz2 |
bpo-39200: Correct the error message for min/max builtin function (GH-17814)
Correct the error message when calling the min() or max() with
no arguments.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_builtin.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 6a88454..5c553a9 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -949,7 +949,12 @@ class BuiltinTest(unittest.TestCase): self.assertEqual(max(1, 2.0, 3), 3) self.assertEqual(max(1.0, 2, 3), 3) - self.assertRaises(TypeError, max) + with self.assertRaisesRegex( + TypeError, + 'max expected at least 1 argument, got 0' + ): + max() + self.assertRaises(TypeError, max, 42) self.assertRaises(ValueError, max, ()) class BadSeq: @@ -1003,7 +1008,12 @@ class BuiltinTest(unittest.TestCase): self.assertEqual(min(1, 2.0, 3), 1) self.assertEqual(min(1.0, 2, 3), 1.0) - self.assertRaises(TypeError, min) + with self.assertRaisesRegex( + TypeError, + 'min expected at least 1 argument, got 0' + ): + min() + self.assertRaises(TypeError, min, 42) self.assertRaises(ValueError, min, ()) class BadSeq: |