[Python-checkins] python/dist/src/Lib/test test_doctest.py, 1.12,
1.13
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Mon Aug 9 05:51:49 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12808/Lib/test
Modified Files:
test_doctest.py
Log Message:
Drop the excruciating newline requirements on arguments to
Example.__init__. The constructor now adds trailing newlines when
needed, and no longer distinguishes between multi- and single-line
cases for source.
Index: test_doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** test_doctest.py 9 Aug 2004 02:06:06 -0000 1.12
--- test_doctest.py 9 Aug 2004 03:51:46 -0000 1.13
***************
*** 128,156 ****
>>> example = doctest.Example('print 1', '1\n', 0)
>>> (example.source, example.want, example.lineno)
! ('print 1', '1\n', 0)
! The `source` string should end in a newline iff the source spans more
! than one line:
! >>> # Source spans a single line: no terminating newline.
>>> e = doctest.Example('print 1', '1\n', 0)
>>> e = doctest.Example('print 1\n', '1\n', 0)
! Traceback (most recent call last):
! AssertionError: source must end with newline iff source contains more than one line
! >>> # Source spans multiple lines: require terminating newline.
>>> e = doctest.Example('print 1;\nprint 2\n', '1\n2\n', 0)
>>> e = doctest.Example('print 1;\nprint 2', '1\n2\n', 0)
! Traceback (most recent call last):
! AssertionError: source must end with newline iff source contains more than one line
! The `want` string should be terminated by a newline, unless it's the
! empty string:
>>> e = doctest.Example('print 1', '1\n', 0)
>>> e = doctest.Example('print 1', '1', 0)
! Traceback (most recent call last):
! AssertionError: non-empty want must end with newline
>>> e = doctest.Example('print', '', 0)
"""
--- 128,166 ----
>>> example = doctest.Example('print 1', '1\n', 0)
>>> (example.source, example.want, example.lineno)
! ('print 1\n', '1\n', 0)
! The `source` string ends in a newline:
! Source spans a single line: no terminating newline.
>>> e = doctest.Example('print 1', '1\n', 0)
+ >>> e.source, e.want
+ ('print 1\n', '1\n')
+
>>> e = doctest.Example('print 1\n', '1\n', 0)
! >>> e.source, e.want
! ('print 1\n', '1\n')
! Source spans multiple lines: require terminating newline.
>>> e = doctest.Example('print 1;\nprint 2\n', '1\n2\n', 0)
+ >>> e.source, e.want
+ ('print 1;\nprint 2\n', '1\n2\n')
+
>>> e = doctest.Example('print 1;\nprint 2', '1\n2\n', 0)
! >>> e.source, e.want
! ('print 1;\nprint 2\n', '1\n2\n')
! The `want` string ends with a newline, unless it's the empty string:
>>> e = doctest.Example('print 1', '1\n', 0)
+ >>> e.source, e.want
+ ('print 1\n', '1\n')
+
>>> e = doctest.Example('print 1', '1', 0)
! >>> e.source, e.want
! ('print 1\n', '1\n')
!
>>> e = doctest.Example('print', '', 0)
+ >>> e.source, e.want
+ ('print\n', '')
"""
***************
*** 181,187 ****
>>> e1, e2 = test.examples
>>> (e1.source, e1.want, e1.lineno)
! ('print 12', '12\n', 1)
>>> (e2.source, e2.want, e2.lineno)
! ("print 'another\\example'", 'another\nexample\n', 6)
Source information (name, filename, and line number) is available as
--- 191,197 ----
>>> e1, e2 = test.examples
>>> (e1.source, e1.want, e1.lineno)
! ('print 12\n', '12\n', 1)
>>> (e2.source, e2.want, e2.lineno)
! ("print 'another\\example'\n", 'another\nexample\n', 6)
Source information (name, filename, and line number) is available as
***************
*** 265,270 ****
[<DocTest sample_func from ...:12 (1 example)>]
>>> e = tests[0].examples[0]
! >>> print (e.source, e.want, e.lineno)
! ('print sample_func(22)', '44\n', 3)
>>> doctest: -ELLIPSIS # Turn ellipsis back off
--- 275,280 ----
[<DocTest sample_func from ...:12 (1 example)>]
>>> e = tests[0].examples[0]
! >>> (e.source, e.want, e.lineno)
! ('print sample_func(22)\n', '44\n', 3)
>>> doctest: -ELLIPSIS # Turn ellipsis back off
More information about the Python-checkins
mailing list