summaryrefslogtreecommitdiff
path: root/Lib/test/test_sort.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_sort.py')
-rw-r--r--Lib/test/test_sort.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py
index a7afe73d1c..55503b57a8 100644
--- a/Lib/test/test_sort.py
+++ b/Lib/test/test_sort.py
@@ -111,6 +111,12 @@ class TestBase(unittest.TestCase):
s.sort(key=CmpToKey(lambda a, b: int(random.random() * 3) - 1))
check("an insane function left some permutation", x, s)
+ if len(x) >= 2:
+ def bad_key(x):
+ raise RuntimeError
+ s = x[:]
+ self.assertRaises(RuntimeError, s.sort, key=bad_key)
+
x = [Complains(i) for i in x]
s = x[:]
random.shuffle(s)