[Python-checkins] python/dist/src/Lib/test test_sort.py,1.3,1.4
montanaro@users.sourceforge.net
montanaro@users.sourceforge.net
Thu, 02 Jan 2003 12:51:37 -0800
- Previous message: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.115,1.116
- Next message: [Python-checkins] python/nondist/sandbox/datetime US.py,1.14,1.15 datetime.py,1.139,1.140 doc.txt,1.78,1.79 test_datetime.py,1.93,1.94
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv5845/Lib/test
Modified Files:
test_sort.py
Log Message:
Allow list sort's comparison function to explicitly be None. See SF patch
661092.
Index: test_sort.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sort.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_sort.py 12 Nov 2002 22:08:08 -0000 1.3
--- test_sort.py 2 Jan 2003 20:51:04 -0000 1.4
***************
*** 146,149 ****
--- 146,169 ----
bug453523()
+ def cmpNone():
+ global nerrors
+
+ if verbose:
+ print "Testing None as a comparison function."
+
+ L = range(50)
+ random.shuffle(L)
+ try:
+ L.sort(None)
+ except TypeError:
+ print " Passing None as cmpfunc failed."
+ nerrors += 1
+ else:
+ if L != range(50):
+ print " Passing None as cmpfunc failed."
+ nerrors += 1
+
+ cmpNone()
+
if nerrors:
print "Test failed", nerrors
- Previous message: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.115,1.116
- Next message: [Python-checkins] python/nondist/sandbox/datetime US.py,1.14,1.15 datetime.py,1.139,1.140 doc.txt,1.78,1.79 test_datetime.py,1.93,1.94
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]