[Python-checkins] python/dist/src/Lib/test test_doctest.py, 1.22, 1.23

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Thu Aug 19 10:10:10 CEST 2004


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

Modified Files:
	test_doctest.py 
Log Message:
Replaced the ELLIPSIS implementation with a worst-case linear-time one.


Index: test_doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** test_doctest.py	19 Aug 2004 06:49:33 -0000	1.22
--- test_doctest.py	19 Aug 2004 08:10:08 -0000	1.23
***************
*** 781,791 ****
      (0, 1)
  
! ... should also match nothing gracefully:
! XXX This can be provoked into requiring exponential time by adding more
! XXX ellipses; the implementation should change.  It's much easier to
! XXX provoke exponential time with expected output that doesn't match,
! XXX BTW (then multiple regexp .* thingies each try all possiblities,
! XXX multiplicatively, without hope of success).  That's the real danger,
! XXX that a failing test will appear to be hung.
  
      >>> for i in range(100):
--- 781,786 ----
      (0, 1)
  
! ... should also match nothing gracefully (note that a regular-expression
! implementation of ELLIPSIS would take a loooong time to match this one!):
  
      >>> for i in range(100):
***************
*** 795,807 ****
      1
      ...
      36
      ...
      ...
      49
      64
!     ......
      9801
      ...
  
  The UNIFIED_DIFF flag causes failures that involve multi-line expected
  and actual outputs to be displayed using a unified diff:
--- 790,819 ----
      1
      ...
+     ......
+     ...
      36
      ...
      ...
+     ...
      49
      64
!     .........
      9801
      ...
  
+ ... can be surprising; e.g., this test passes:
+ 
+     >>> for i in range(21): #doctest: +ELLIPSIS
+     ...     print i
+     0
+     1
+     2
+     ...
+     1
+     ...
+     2
+     ...
+     0
+ 
  The UNIFIED_DIFF flag causes failures that involve multi-line expected
  and actual outputs to be displayed using a unified diff:



More information about the Python-checkins mailing list