From 60f5e1023066b92270d01aa121efe228f6edc379 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Wed, 15 Aug 2012 18:19:21 +0200 Subject: [PATCH] [py3] Fixed dispatch tests --- django/dispatch/saferef.py | 6 ++++-- tests/regressiontests/dispatch/tests/test_saferef.py | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/django/dispatch/saferef.py b/django/dispatch/saferef.py index d8728e219a..84d1b2183c 100644 --- a/django/dispatch/saferef.py +++ b/django/dispatch/saferef.py @@ -149,9 +149,11 @@ class BoundMethodWeakref(object): self.selfName, self.funcName, ) - + __repr__ = __str__ - + + __hash__ = object.__hash__ + def __bool__( self ): """Whether we are still a valid reference""" return self() is not None diff --git a/tests/regressiontests/dispatch/tests/test_saferef.py b/tests/regressiontests/dispatch/tests/test_saferef.py index cfe6c5df85..30eaddfe18 100644 --- a/tests/regressiontests/dispatch/tests/test_saferef.py +++ b/tests/regressiontests/dispatch/tests/test_saferef.py @@ -54,10 +54,8 @@ class SaferefTests(unittest.TestCase): sd[s] = 1 for t in self.ts: if hasattr(t, 'x'): - self.assertTrue(sd.has_key(safeRef(t.x))) self.assertTrue(safeRef(t.x) in sd) else: - self.assertTrue(sd.has_key(safeRef(t))) self.assertTrue(safeRef(t) in sd) def testRepresentation(self):