Followup to #7502: add __hash__ method and tests.
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 676d5de..5969ce2 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -258,6 +258,21 @@
>>> e = doctest.Example('raise X()', '', exc_msg)
>>> e.exc_msg
'\n'
+
+Compare `Example`:
+ >>> example = doctest.Example('print 1', '1\n')
+ >>> same_example = doctest.Example('print 1', '1\n')
+ >>> other_example = doctest.Example('print 42', '42\n')
+ >>> example == same_example
+ True
+ >>> example != same_example
+ False
+ >>> hash(example) == hash(same_example)
+ True
+ >>> example == other_example
+ False
+ >>> example != other_example
+ True
"""
def test_DocTest(): r"""
@@ -361,6 +376,8 @@
True
>>> test != same_test
False
+ >>> hash(test) == hash(same_test)
+ True
>>> docstring = '''
... >>> print 42
... 42
@@ -382,6 +399,8 @@
True
>>> test_case != same_test_case
False
+ >>> hash(test_case) == hash(same_test_case)
+ True
>>> test == other_test_case
False
>>> test != other_test_case