[py3] Fixed dispatch tests

This commit is contained in:
Claude Paroz 2012-08-15 18:19:21 +02:00
parent 27192564c3
commit 60f5e10230
2 changed files with 4 additions and 4 deletions

View File

@ -149,9 +149,11 @@ class BoundMethodWeakref(object):
self.selfName, self.selfName,
self.funcName, self.funcName,
) )
__repr__ = __str__ __repr__ = __str__
__hash__ = object.__hash__
def __bool__( self ): def __bool__( self ):
"""Whether we are still a valid reference""" """Whether we are still a valid reference"""
return self() is not None return self() is not None

View File

@ -54,10 +54,8 @@ class SaferefTests(unittest.TestCase):
sd[s] = 1 sd[s] = 1
for t in self.ts: for t in self.ts:
if hasattr(t, 'x'): if hasattr(t, 'x'):
self.assertTrue(sd.has_key(safeRef(t.x)))
self.assertTrue(safeRef(t.x) in sd) self.assertTrue(safeRef(t.x) in sd)
else: else:
self.assertTrue(sd.has_key(safeRef(t)))
self.assertTrue(safeRef(t) in sd) self.assertTrue(safeRef(t) in sd)
def testRepresentation(self): def testRepresentation(self):