[Python-checkins] python/dist/src/Lib/test test_doctest.py, 1.15, 1.16

edloper at users.sourceforge.net edloper at users.sourceforge.net
Mon Aug 9 18:14:57 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30812/test
Modified Files:
	test_doctest.py 
Log Message:
- DocTest is now a simple container class; its constructor is no longer
 responsible for parsing the string.
- Renamed Parser to DocTestParser
- DocTestParser.get_*() now accept the string & name as command-line
 arguments; the parser's constructor is now empty.
- Added DocTestParser.get_doctest() method
- Replaced "doctest_factory" argument to DocTestFinder with a "parser"
 argument (takes a DocTestParser).
- Changed _tag_msg to take an indentation string argument.
Index: test_doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** test_doctest.py	9 Aug 2004 15:43:47 -0000	1.15
--- test_doctest.py	9 Aug 2004 16:14:41 -0000	1.16
***************
*** 184,188 ****
 ... '''
 >>> globs = {} # globals to run the test in.
! >>> test = doctest.DocTest(docstring, globs, 'some_test', 'some_file', 20)
 >>> print test
 <DocTest some_test from some_file:20 (2 examples)>
--- 184,190 ----
 ... '''
 >>> globs = {} # globals to run the test in.
! >>> parser = doctest.DocTestParser()
! >>> test = parser.get_doctest(docstring, globs, 'some_test',
! ... 'some_file', 20)
 >>> print test
 <DocTest some_test from some_file:20 (2 examples)>
***************
*** 218,222 ****
 ... indentation
 ... '''
! >>> 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'
--- 220,224 ----
 ... indentation
 ... '''
! >>> parser.get_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'
***************
*** 230,234 ****
 ... ('bad', 'indentation')
 ... '''
! >>> doctest.DocTest(docstring, globs, 'some_test', 'filename', 0)
 Traceback (most recent call last):
 ValueError: line 2 of the docstring for some_test has inconsistent leading whitespace: ' ... 2)'
--- 232,236 ----
 ... ('bad', 'indentation')
 ... '''
! >>> parser.get_doctest(docstring, globs, 'some_test', 'filename', 0)
 Traceback (most recent call last):
 ValueError: line 2 of the docstring for some_test has inconsistent leading whitespace: ' ... 2)'
***************
*** 238,242 ****
 
 >>> docstring = '>>>print 1\n1'
! >>> 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'
--- 240,244 ----
 
 >>> docstring = '>>>print 1\n1'
! >>> parser.get_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'
***************
*** 246,250 ****
 
 >>> 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'
--- 248,252 ----
 
 >>> docstring = '>>> if 1:\n...print 1\n1'
! >>> parser.get_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'
***************
*** 999,1003 ****
 ... >>> import pdb; pdb.set_trace()
 ... '''
! >>> test = doctest.DocTest(doc, {}, "foo", "foo.py", 0)
 >>> runner = doctest.DocTestRunner(verbose=False)
 
--- 1001,1006 ----
 ... >>> import pdb; pdb.set_trace()
 ... '''
! >>> parser = doctest.DocTestParser()
! >>> test = parser.get_doctest(doc, {}, "foo", "foo.py", 0)
 >>> runner = doctest.DocTestRunner(verbose=False)
 
***************
*** 1041,1045 ****
 ... >>> calls_set_trace()
 ... '''
! >>> test = doctest.DocTest(doc, globals(), "foo", "foo.py", 0)
 
 >>> fake_stdin = tempfile.TemporaryFile(mode='w+')
--- 1044,1048 ----
 ... >>> calls_set_trace()
 ... '''
! >>> test = parser.get_doctest(doc, globals(), "foo", "foo.py", 0)
 
 >>> fake_stdin = tempfile.TemporaryFile(mode='w+')


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /