]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Followup to #7502: add __hash__ method and tests.
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 18 Dec 2011 19:22:50 +0000 (20:22 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 18 Dec 2011 19:22:50 +0000 (20:22 +0100)
1  2 
Lib/doctest.py
Lib/test/test_doctest.py

diff --cc Lib/doctest.py
index 5d315cc5a3e58ab812ae7783d8b51ca99ba03395,234733e5651c5359d2aee3704b6bd7494c76f54f..aba98dc5a3548926cf8a4962c9e4dbd92e6dda0b
@@@ -454,7 -454,11 +454,10 @@@ class Example
      def __ne__(self, other):
          return not self == other
  
+     def __hash__(self):
+         return hash((self.source, self.want, self.lineno, self.indent,
+                      self.exc_msg))
  
 -
  class DocTest:
      """
      A collection of doctest examples that should be run in a single
Simple merge