diff options
author | Collin Winter <collinw@gmail.com> | 2007-03-09 23:30:39 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-03-09 23:30:39 (GMT) |
commit | 9453e5dce526f6d1b36890cd0e1e42ff77c84918 (patch) | |
tree | 8f98ec338e1412176b0a2ab89d596a8459058314 | |
parent | 2456a3c02aa295c82fc84aaf6d0740d95aeb05b1 (diff) | |
download | cpython-9453e5dce526f6d1b36890cd0e1e42ff77c84918.zip cpython-9453e5dce526f6d1b36890cd0e1e42ff77c84918.tar.gz cpython-9453e5dce526f6d1b36890cd0e1e42ff77c84918.tar.bz2 |
Hashing simplification pointed out by Thomas Wouters.
-rw-r--r-- | Lib/unittest.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/unittest.py b/Lib/unittest.py index 483f006..7ea240c 100644 --- a/Lib/unittest.py +++ b/Lib/unittest.py @@ -245,7 +245,7 @@ class TestCase: return not self == other def __hash__(self): - return hash(str(hash(type(self))) + str(hash(self._testMethodName))) + return hash((type(self), self._testMethodName)) def __str__(self): return "%s (%s)" % (self._testMethodName, _strclass(self.__class__)) @@ -502,9 +502,8 @@ class FunctionTestCase(TestCase): return not self == other def __hash__(self): - return hash(''.join(str(hash(x)) for x in [ - type(self), self.__setUpFunc, self.__tearDownFunc, self.__testFunc, - self.__description])) + return hash((type(self), self.__setUpFunc, self.__tearDownFunc, + self.__testFunc, self.__description)) def __str__(self): return "%s (%s)" % (_strclass(self.__class__), self.__testFunc.__name__) |