summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
authorAlexander Marshalov <_@marshalov.org>2018-07-24 03:58:21 (GMT)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2018-07-24 03:58:21 (GMT)
commite22072fb11246f125aa9ff7629c832b9e2407ef0 (patch)
tree8cbe81568e233643182d0c952b62c6fdf3ba060a /Lib/test/test_builtin.py
parentbde782bb594edffeabe978abeee2b7082ab9bc2a (diff)
downloadcpython-e22072fb11246f125aa9ff7629c832b9e2407ef0.zip
cpython-e22072fb11246f125aa9ff7629c832b9e2407ef0.tar.gz
cpython-e22072fb11246f125aa9ff7629c832b9e2407ef0.tar.bz2
bpo-34149: Behavior of the min/max with key=None (GH-8328)
Improve consistency with the signature for sorted(), heapq.nsmallest(), heapq.nlargest(), and itertools.groupby().
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 8f91bc9..233c579 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -905,6 +905,8 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(max((), default=1, key=neg), 1)
self.assertEqual(max((1, 2), default=3, key=neg), 1)
+ self.assertEqual(max((1, 2), key=None), 2)
+
data = [random.randrange(200) for i in range(100)]
keys = dict((elem, random.randrange(50)) for elem in data)
f = keys.__getitem__
@@ -957,6 +959,8 @@ class BuiltinTest(unittest.TestCase):
self.assertEqual(min((), default=1, key=neg), 1)
self.assertEqual(min((1, 2), default=1, key=neg), 2)
+ self.assertEqual(min((1, 2), key=None), 1)
+
data = [random.randrange(200) for i in range(100)]
keys = dict((elem, random.randrange(50)) for elem in data)
f = keys.__getitem__