diff -r 1c4d9534263e Lib/doctest.py --- a/Lib/doctest.py Sun Dec 18 19:39:53 2011 +0100 +++ b/Lib/doctest.py Sun Dec 18 19:59:30 2011 +0100 @@ -465,6 +465,10 @@ def __ne__(self, other): return not self == other + def __hash__(self): + return hash((self.source, self.want, self.lineno, self.indent, + self.options, self.exc_msg)) + class DocTest: """ @@ -528,6 +532,10 @@ def __ne__(self, other): return not self == other + def __hash__(self): + return hash((self.docstring, self.globs, self.name, self.filename, + self.lineno)) + # This lets us sort tests by name: def __cmp__(self, other): if not isinstance(other, DocTest): @@ -2293,6 +2301,10 @@ def __ne__(self, other): return not self == other + def __hash__(self): + return hash((self._dt_optionflags, self._dt_setUp, self._dt_tearDown, + self._dt_checker)) + def __repr__(self): name = self._dt_test.name.split('.') return "%s (%s)" % (name[-1], '.'.join(name[:-1]))