[Python-checkins] python/dist/src/Lib/test test_doctest.py, 1.11,
1.12
edloper at users.sourceforge.net
edloper at users.sourceforge.net
Mon Aug 9 04:06:08 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31571/dist/src/Lib/test
Modified Files:
test_doctest.py
Log Message:
Rewrote Parser, using regular expressions instead of walking though
the string one line at a time. The resulting code is (in my opinion,
anyway), much easier to read. In the process, I found and fixed a
bug in the orginal parser's line numbering in error messages (it was
inconsistant between 0-based and 1-based). Also, check for missing
blank lines after the prompt on all prompt lines, not just PS1 lines
(test added).
Index: test_doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** test_doctest.py 8 Aug 2004 06:11:48 -0000 1.11
--- test_doctest.py 9 Aug 2004 02:06:06 -0000 1.12
***************
*** 210,214 ****
>>> doctest.DocTest(docstring, globs, 'some_test', 'filename', 0)
Traceback (most recent call last):
! ValueError: line 3 of the docstring for some_test has inconsistent leading whitespace: ' indentation'
If the docstring contains inconsistent leading whitespace on
--- 210,214 ----
>>> doctest.DocTest(docstring, globs, 'some_test', 'filename', 0)
Traceback (most recent call last):
! ValueError: line 4 of the docstring for some_test has inconsistent leading whitespace: ' indentation'
If the docstring contains inconsistent leading whitespace on
***************
*** 230,234 ****
>>> doctest.DocTest(docstring, globs, 'some_test', 'filename', 0)
Traceback (most recent call last):
! ValueError: line 0 of the docstring for some_test lacks blank after >>>: '>>>print 1'
"""
--- 230,243 ----
>>> doctest.DocTest(docstring, globs, 'some_test', 'filename', 0)
Traceback (most recent call last):
! ValueError: line 1 of the docstring for some_test lacks blank after >>>: '>>>print 1'
!
! If there's no blank space after a PS2 prompt ('...'), then `DocTest`
! will raise a ValueError:
!
! >>> docstring = '>>> if 1:\n...print 1\n1'
! >>> doctest.DocTest(docstring, globs, 'some_test', 'filename', 0)
! Traceback (most recent call last):
! ValueError: line 2 of the docstring for some_test lacks blank after ...: '...print 1'
!
"""
More information about the Python-checkins
mailing list