[Python-checkins] CVS: python/dist/src/Lib/test test_compare.py,1.3,1.4
Guido van Rossum
gvanrossum@users.sourceforge.net
2001年8月15日 14:02:22 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv18018
Modified Files:
test_compare.py
Log Message:
Given a class without __cmp__ or __eq__, cmp() of two instances of
that class should compare the id() of those instances. Add a test
that verifies this. This test currently fails; I believe this is
caused by object.c:2.132 (Patch #424475 by loewis).
Index: test_compare.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_compare.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_compare.py 2001年01月04日 01:34:52 1.3
--- test_compare.py 2001年08月15日 21:02:20 1.4
***************
*** 45,48 ****
--- 45,56 ----
else:
print "%s != %s" % (a, b)
+ # Ensure default comparison compares id() of args
+ L = [None]
+ for i in range(10):
+ L.insert(len(L)/2, Empty())
+ for a in L:
+ for b in L:
+ if cmp(a, b) != cmp(id(a), id(b)):
+ print "ERROR:", cmp(a, b), cmp(id(a), id(b)), id(a), id(b)
test()