diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-18 19:28:33 +0100 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-18 19:28:33 +0100 |
commit | 0eb4aa847cd4a61b443072f6fae843c7203cc474 (patch) | |
tree | 0c11bb41adaec3deb13b1701e3c537e8b5e67456 /Lib/test | |
parent | e646f8f51e4c2431a5706a8d84dfa84b6d67f37d (diff) | |
parent | e595a73b206f89da311bf472fa0e669d30a24dc1 (diff) | |
download | cpython-0eb4aa847cd4a61b443072f6fae843c7203cc474.tar.gz |
Merge
Diffstat (limited to 'Lib/test')
-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 13836bafa0..676d5de6f7 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -347,6 +347,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""" |