diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-18 18:29:06 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-18 18:29:06 (GMT) |
commit | 92d4acb7a7f13fb785e9552ed486e301809008a5 (patch) | |
tree | e3bbee6f3f05e09f2a8091a6d02e8dc1d886ff6f /Lib/test/test_doctest.py | |
parent | 0f694d72a284ac656772806f09ea9bf454550a98 (diff) | |
parent | a74252633f2d86b3108b80c929583abd4193d7be (diff) | |
download | cpython-92d4acb7a7f13fb785e9552ed486e301809008a5.zip cpython-92d4acb7a7f13fb785e9552ed486e301809008a5.tar.gz cpython-92d4acb7a7f13fb785e9552ed486e301809008a5.tar.bz2 |
Issue #7502: Fix equality comparison for DocTestCase instances.
Patch by Cédric Krier.
Diffstat (limited to 'Lib/test/test_doctest.py')
-rw-r--r-- | Lib/test/test_doctest.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py index cd87179..ac79e02 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -348,6 +348,46 @@ will raise a ValueError: Traceback (most recent call last): ValueError: line 2 of the docstring for some_test lacks blank after ...: '...print(1)' +Compare `DocTest`: + + >>> docstring = ''' + ... >>> print 12 + ... 12 + ... ''' + >>> test = parser.get_doctest(docstring, globs, 'some_test', + ... 'some_test', 20) + >>> same_test = parser.get_doctest(docstring, globs, 'some_test', + ... 'some_test', 20) + >>> test == same_test + True + >>> test != same_test + False + >>> docstring = ''' + ... >>> print 42 + ... 42 + ... ''' + >>> other_test = parser.get_doctest(docstring, globs, 'other_test', + ... 'other_file', 10) + >>> test == other_test + False + >>> test != other_test + True + +Compare `DocTestCase`: + + >>> DocTestCase = doctest.DocTestCase + >>> test_case = DocTestCase(test) + >>> same_test_case = DocTestCase(same_test) + >>> other_test_case = DocTestCase(other_test) + >>> test_case == same_test_case + True + >>> test_case != same_test_case + False + >>> test == other_test_case + False + >>> test != other_test_case + True + """ def test_DocTestFinder(): r""" |