diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_sort.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py index a7afe73..55503b5 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) |