summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compare.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-08-15 21:02:20 (GMT)
committerGuido van Rossum <guido@python.org>2001-08-15 21:02:20 (GMT)
commit28962cc0ea5ff29a7b96b995e1ee3f1bae138148 (patch)
tree349c88c6bc4ba11f7f4cf19a7b8d08a72a85c02c /Lib/test/test_compare.py
parentce1650f3a5afd895ef2d1d61143d72bb88127810 (diff)
downloadcpython-28962cc0ea5ff29a7b96b995e1ee3f1bae138148.zip
cpython-28962cc0ea5ff29a7b96b995e1ee3f1bae138148.tar.gz
cpython-28962cc0ea5ff29a7b96b995e1ee3f1bae138148.tar.bz2
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).
Diffstat (limited to 'Lib/test/test_compare.py')
-rw-r--r--Lib/test/test_compare.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_compare.py b/Lib/test/test_compare.py
index 9184355..1d8b947 100644
--- a/Lib/test/test_compare.py
+++ b/Lib/test/test_compare.py
@@ -44,5 +44,13 @@ def test():
print "%s == %s" % (a, b)
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()