Commit 9453e5dc authored by Collin Winter's avatar Collin Winter

Hashing simplification pointed out by Thomas Wouters.

parent 2456a3c0
...@@ -245,7 +245,7 @@ class TestCase: ...@@ -245,7 +245,7 @@ class TestCase:
return not self == other return not self == other
def __hash__(self): def __hash__(self):
return hash(str(hash(type(self))) + str(hash(self._testMethodName))) return hash((type(self), self._testMethodName))
def __str__(self): def __str__(self):
return "%s (%s)" % (self._testMethodName, _strclass(self.__class__)) return "%s (%s)" % (self._testMethodName, _strclass(self.__class__))
...@@ -502,9 +502,8 @@ class FunctionTestCase(TestCase): ...@@ -502,9 +502,8 @@ class FunctionTestCase(TestCase):
return not self == other return not self == other
def __hash__(self): def __hash__(self):
return hash(''.join(str(hash(x)) for x in [ return hash((type(self), self.__setUpFunc, self.__tearDownFunc,
type(self), self.__setUpFunc, self.__tearDownFunc, self.__testFunc, self.__testFunc, self.__description))
self.__description]))
def __str__(self): def __str__(self):
return "%s (%s)" % (_strclass(self.__class__), self.__testFunc.__name__) return "%s (%s)" % (_strclass(self.__class__), self.__testFunc.__name__)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment