Author: Armin Rigo <[email protected]>
Branch:
Changeset: r59856:2dc74be985d3
Date: 2013-01-07 21:18 +0100
http://bitbucket.org/pypy/pypy/changeset/2dc74be985d3/
Log: Add a passing test.
diff --git a/pypy/module/_weakref/test/test_weakref.py
b/pypy/module/_weakref/test/test_weakref.py
--- a/pypy/module/_weakref/test/test_weakref.py
+++ b/pypy/module/_weakref/test/test_weakref.py
@@ -114,19 +114,28 @@
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 A(object):
def __eq__(self, other):
return True
+ def __ne__(self, other):
+ return False
a = A()
assert _weakref.ref(a) == a
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit