[Python-checkins] python/dist/src/Lib/test test_doctest.py, 1.5.18.7, 1.5.18.8

edloper at users.sourceforge.net edloper at users.sourceforge.net
Wed Aug 4 03:07:27 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19299/test

Modified Files:
      Tag: tim-doctest-branch
	test_doctest.py 
Log Message:
- Pass globals to DocTest/DocTestFinder, not DocTestRunner


Index: test_doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest.py,v
retrieving revision 1.5.18.7
retrieving revision 1.5.18.8
diff -C2 -d -r1.5.18.7 -r1.5.18.8
*** test_doctest.py	3 Aug 2004 20:13:12 -0000	1.5.18.7
--- test_doctest.py	4 Aug 2004 01:07:22 -0000	1.5.18.8
***************
*** 169,173 ****
      ...     example
      ... '''
!     >>> test = doctest.DocTest(docstring, 'some_test', 'some_file', 20)
      >>> print test
      <DocTest some_test from some_file:20 (2 examples)>
--- 169,174 ----
      ...     example
      ... '''
!     >>> 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)>
***************
*** 203,207 ****
      ...     indentation
      ...     '''
!     >>> doctest.DocTest(docstring, 'some_test', 'filename', 0)
      Traceback (most recent call last):
      ValueError: line 3 of the docstring for some_test has inconsistent leading whitespace: '    indentation'
--- 204,208 ----
      ...     indentation
      ...     '''
!     >>> 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'
***************
*** 215,219 ****
      ...       ('bad', 'indentation')
      ...     '''
!     >>> doctest.DocTest(docstring, 'some_test', 'filename', 0)
      Traceback (most recent call last):
      ValueError: line 2 of the docstring for some_test has inconsistent leading whitespace: '    ...          2)'
--- 216,220 ----
      ...       ('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)'
***************
*** 223,227 ****
  
      >>> docstring = '>>>print 1\n1'
!     >>> doctest.DocTest(docstring, 'some_test', 'filename', 0)
      Traceback (most recent call last):
      ValueError: line 0 of the docstring for some_test lacks blank after >>>: '>>>print 1'
--- 224,228 ----
  
      >>> docstring = '>>>print 1\n1'
!     >>> 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'
***************
*** 473,477 ****
  of tried tests.
  
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      (0, 3)
  
--- 474,478 ----
  of tried tests.
  
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      (0, 3)
  
***************
*** 488,492 ****
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=True).run(test, {})
      Trying: x = 12
      Expecting: nothing
--- 489,493 ----
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=True).run(test)
      Trying: x = 12
      Expecting: nothing
***************
*** 518,522 ****
      >>> test = doctest.DocTestFinder().find(f)[0]
  
!     >>> doctest.DocTestRunner(verbose=True).run(test, {})
      Trying: x = 12
      Expecting: nothing
--- 519,523 ----
      >>> test = doctest.DocTestFinder().find(f)[0]
  
!     >>> doctest.DocTestRunner(verbose=True).run(test)
      Trying: x = 12
      Expecting: nothing
***************
*** 538,547 ****
      >>> # If -v does not appear in sys.argv, then output isn't verbose.
      >>> sys.argv = ['test']
!     >>> doctest.DocTestRunner().run(test, {})
      (0, 3)
  
      >>> # If -v does appear in sys.argv, then output is verbose.
      >>> sys.argv = ['test', '-v']
!     >>> doctest.DocTestRunner().run(test, {})
      Trying: x = 12
      Expecting: nothing
--- 539,548 ----
      >>> # If -v does not appear in sys.argv, then output isn't verbose.
      >>> sys.argv = ['test']
!     >>> doctest.DocTestRunner().run(test)
      (0, 3)
  
      >>> # If -v does appear in sys.argv, then output is verbose.
      >>> sys.argv = ['test', '-v']
!     >>> doctest.DocTestRunner().run(test)
      Trying: x = 12
      Expecting: nothing
***************
*** 576,580 ****
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      (0, 2)
  
--- 577,581 ----
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      (0, 2)
  
***************
*** 591,595 ****
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      (0, 2)
  
--- 592,596 ----
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      (0, 2)
  
***************
*** 605,609 ****
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      (0, 1)
  
--- 606,610 ----
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      (0, 1)
  
***************
*** 618,622 ****
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      **********************************************************************
      Failure in example: raise ValueError, 'message'
--- 619,623 ----
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      **********************************************************************
      Failure in example: raise ValueError, 'message'
***************
*** 643,647 ****
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      **********************************************************************
      Failure in example: 1/0
--- 644,648 ----
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      **********************************************************************
      Failure in example: 1/0
***************
*** 649,655 ****
      Exception raised:
          Traceback (most recent call last):
!           File "...", line ..., in __run
!             compileflags, 1) in globs
!           File "<string>", line 1, in ?
          ZeroDivisionError: integer division or modulo by zero
      (1, 1)
--- 650,654 ----
      Exception raised:
          Traceback (most recent call last):
!           ...
          ZeroDivisionError: integer division or modulo by zero
      (1, 1)
***************
*** 673,677 ****
      >>> # Without the flag:
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      (0, 1)
  
--- 672,676 ----
      >>> # Without the flag:
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      (0, 1)
  
***************
*** 679,683 ****
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.DONT_ACCEPT_TRUE_FOR_1
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test, {})
      **********************************************************************
      Failure in example: True
--- 678,682 ----
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.DONT_ACCEPT_TRUE_FOR_1
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
      **********************************************************************
      Failure in example: True
***************
*** 695,699 ****
      >>> # Without the flag:
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      (0, 1)
  
--- 694,698 ----
      >>> # Without the flag:
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      (0, 1)
  
***************
*** 701,705 ****
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.DONT_ACCEPT_BLANKLINE
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test, {})
      **********************************************************************
      Failure in example: print "a\n\nb"
--- 700,704 ----
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.DONT_ACCEPT_BLANKLINE
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
      **********************************************************************
      Failure in example: print "a\n\nb"
***************
*** 723,727 ****
      >>> # Without the flag:
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      **********************************************************************
      Failure in example: print 1, 2, 3
--- 722,726 ----
      >>> # Without the flag:
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      **********************************************************************
      Failure in example: print 1, 2, 3
***************
*** 736,740 ****
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.NORMALIZE_WHITESPACE
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test, {})
      (0, 1)
  
--- 735,739 ----
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.NORMALIZE_WHITESPACE
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
      (0, 1)
  
***************
*** 747,751 ****
      >>> # Without the flag:
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      **********************************************************************
      Failure in example: print range(15)
--- 746,750 ----
      >>> # Without the flag:
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      **********************************************************************
      Failure in example: print range(15)
***************
*** 758,762 ****
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.ELLIPSIS
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test, {})
      (0, 1)
  
--- 757,761 ----
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.ELLIPSIS
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
      (0, 1)
  
***************
*** 778,782 ****
      >>> # Without the flag:
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      **********************************************************************
      Failure in example: print '\n'.join('abcdefg')
--- 777,781 ----
      >>> # Without the flag:
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      **********************************************************************
      Failure in example: print '\n'.join('abcdefg')
***************
*** 803,807 ****
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.UNIFIED_DIFF
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test, {})
      **********************************************************************
      Failure in example: print '\n'.join('abcdefg')
--- 802,806 ----
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.UNIFIED_DIFF
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
      **********************************************************************
      Failure in example: print '\n'.join('abcdefg')
***************
*** 829,833 ****
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.CONTEXT_DIFF
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test, {})
      **********************************************************************
      Failure in example: print '\n'.join('abcdefg')
--- 828,832 ----
      >>> test = doctest.DocTestFinder().find(f)[0]
      >>> flags = doctest.CONTEXT_DIFF
!     >>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
      **********************************************************************
      Failure in example: print '\n'.join('abcdefg')
***************
*** 878,882 ****
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      **********************************************************************
      Failure in example: print range(10)       # Should fail: no ellipsis
--- 877,881 ----
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      **********************************************************************
      Failure in example: print range(10)       # Should fail: no ellipsis
***************
*** 901,905 ****
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test, {})
      **********************************************************************
      Failure in example: print range(10)       # Should fail
--- 900,904 ----
      ...     '''
      >>> test = doctest.DocTestFinder().find(f)[0]
!     >>> doctest.DocTestRunner(verbose=False).run(test)
      **********************************************************************
      Failure in example: print range(10)       # Should fail



More information about the Python-checkins mailing list