[Python-checkins] python/dist/src/Lib/test test_sort.py,1.7,1.8
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Fri Nov 28 16:43:04 EST 2003
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv3998/Lib/test
Modified Files:
test_sort.py
Log Message:
Make sure the list.sort's decorate step unwinds itself before returning
an exception raised by the key function.
(Suggested by Michael Hudson.)
Index: test_sort.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sort.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** test_sort.py 16 Nov 2003 16:17:48 -0000 1.7
--- test_sort.py 28 Nov 2003 21:43:02 -0000 1.8
***************
*** 187,190 ****
--- 187,197 ----
self.assertRaises(TypeError, data.sort, "bad", str.lower)
+ def test_key_with_exception(self):
+ # Verify that the wrapper has been removed
+ data = range(-2,2)
+ dup = data[:]
+ self.assertRaises(ZeroDivisionError, data.sort, None, lambda x: 1/x)
+ self.assertEqual(data, dup)
+
def test_reverse(self):
data = range(100)
More information about the Python-checkins
mailing list