aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2013-01-07 21:18:25 +0100
committerArmin Rigo <arigo@tunes.org>2013-01-07 21:18:25 +0100
commit2fa0f932f30568325ea2129fe0ffc8e41722b7a6 (patch)
tree1b20631b390fa6199f69fe00fe13ef81367d5fbf /pypy/module/_weakref
parentmove call to make_cmdline_overview so that readthedocs can find it (diff)
downloadpypy-2fa0f932f30568325ea2129fe0ffc8e41722b7a6.tar.gz
pypy-2fa0f932f30568325ea2129fe0ffc8e41722b7a6.tar.bz2
pypy-2fa0f932f30568325ea2129fe0ffc8e41722b7a6.zip
Add a passing test.
Diffstat (limited to 'pypy/module/_weakref')
-rw-r--r--pypy/module/_weakref/test/test_weakref.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/pypy/module/_weakref/test/test_weakref.py b/pypy/module/_weakref/test/test_weakref.py
index 46a55f39b6..8a645ae6b4 100644
--- a/pypy/module/_weakref/test/test_weakref.py
+++ b/pypy/module/_weakref/test/test_weakref.py
@@ -114,19 +114,28 @@ class AppTestWeakref(object):
class A(object):
def __eq__(self, other):
return True
+ def __ne__(self, other):
+ return False
a1 = A()
a2 = A()
ref1 = _weakref.ref(a1)
ref2 = _weakref.ref(a2)
assert ref1 == ref2
+ assert not (ref1 != ref2)
+ assert not (ref1 == [])
+ assert ref1 != []
del a1
gc.collect()
assert not ref1 == ref2
assert ref1 != ref2
+ assert not (ref1 == [])
+ assert ref1 != []
del a2
gc.collect()
assert not ref1 == ref2
assert ref1 != ref2
+ assert not (ref1 == [])
+ assert ref1 != []
def test_getweakrefs(self):
import _weakref, gc
@@ -435,6 +444,8 @@ class AppTestProxy(object):
class A(object):
def __eq__(self, other):
return True
+ def __ne__(self, other):
+ return False
a = A()
assert _weakref.ref(a) == a