[pypy-svn] rev 2519 - pypy/trunk/src/pypy/appspace
pmaupin at codespeak.net
pmaupin at codespeak.net
Thu Dec 18 16:58:13 CET 2003
Author: pmaupin
Date: Thu Dec 18 16:58:12 2003
New Revision: 2519
Modified:
pypy/trunk/src/pypy/appspace/builtin_types_test.py
Log:
Update tests for sort -- added comparison function
Modified: pypy/trunk/src/pypy/appspace/builtin_types_test.py
==============================================================================
--- pypy/trunk/src/pypy/appspace/builtin_types_test.py (original)
+++ pypy/trunk/src/pypy/appspace/builtin_types_test.py Thu Dec 18 16:58:12 2003
@@ -415,7 +415,6 @@
if a != [2,1,0,-1,-2]: raise TestFailed, 'list reverse'
a.sort()
if a != [-2,-1,0,1,2]: raise TestFailed, 'list sort'
-''' TODO: Support comparison functions XXX
def revcmp(a, b): return cmp(b, a)
a.sort(revcmp)
if a != [2,1,0,-1,-2]: raise TestFailed, 'list sort with cmp func'
@@ -429,17 +428,18 @@
except TypeError: pass
else: raise TestFailed, 'list sort compare function is not callable'
+''' XXX TODO: add detection of list modification during sort
def selfmodifyingComparison(x,y):
z.append(1)
return cmp(x, y)
try: z.sort(selfmodifyingComparison)
except ValueError: pass
else: raise TestFailed, 'modifying list during sort'
+'''
try: z.sort(lambda x, y: 's')
except TypeError: pass
else: raise TestFailed, 'list sort compare function does not return int'
-'''
# Test extreme cases with long ints
a = [0,1,2,3,4]
@@ -788,3 +788,4 @@
except TypeError: pass
else: raise TestFailed, "buffer slice assignment should raise TypeError"
'''
+print '6.99999999... All tests ran to completion'
\ No newline at end of file
More information about the Pypy-commit
mailing list