[Python-checkins] python/dist/src/Lib/test test_doctest.py, 1.26,
1.27
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Sun Aug 22 21:43:32 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6294/Lib/test
Modified Files:
test_doctest.py
Log Message:
Added NDIFF_DIFF option.
Index: test_doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- test_doctest.py 22 Aug 2004 14:10:00 -0000 1.26
+++ test_doctest.py 22 Aug 2004 19:43:28 -0000 1.27
@@ -283,7 +283,7 @@
'test_doctest.py'
>>> test.test_doctest.__file__ = old
-
+
>>> e = tests[0].examples[0]
>>> (e.source, e.want, e.lineno)
@@ -931,7 +931,33 @@
g
<BLANKLINE>
(1, 1)
-"""
+
+
+The NDIFF_DIFF flag causes failures to use the difflib.Differ algorithm
+used by the popular ndiff.py utility. This does intraline difference
+marking, as well as interline differences.
+
+ >>> def f(x):
+ ... r'''
+ ... >>> print "a b c d e f g h i j k l m"
+ ... a b c d e f g h i j k 1 m
+ ... '''
+ >>> test = doctest.DocTestFinder().find(f)[0]
+ >>> flags = doctest.NDIFF_DIFF
+ >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
+ **********************************************************************
+ Line 2, in f
+ Failed example:
+ print "a b c d e f g h i j k l m"
+ Differences (ndiff with -expected +actual):
+ - a b c d e f g h i j k 1 m
+ ? ^
+ + a b c d e f g h i j k l m
+ ? + ++ ^
+ <BLANKLINE>
+ (1, 1)
+ """
+
def option_directives(): r"""
Tests of `DocTestRunner`'s option directive mechanism.
@@ -1468,7 +1494,7 @@
def test_trailing_space_in_test():
"""
Trailing spaces in expcted output are significant:
-
+
>>> x, y = 'foo', ''
>>> print x, y
foo \n
More information about the Python-checkins
mailing list