Allow list sort's comparison function to explicitly be None. See SF patch

661092.
This commit is contained in:
Skip Montanaro 2003-01-02 20:51:08 +00:00
parent fe8496ca03
commit 4abd5f0fce
4 changed files with 34 additions and 6 deletions

View file

@ -145,6 +145,26 @@ def bug453523():
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
elif verbose: