[Python-checkins] python/dist/src/Misc NEWS,1.789,1.790

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Fri, 27 Jun 2003 13:48:08 -0700


Update of /cvsroot/python/python/dist/src/Misc
In directory sc8-pr-cvs1:/tmp/cvs-serv21606/Misc

Modified Files:
	NEWS 
Log Message:
A hack to ease compatibility with pre-2.3 Pythons:  by default, doctest
now accepts "True" when a test expects "1", and similarly for "False"
versus "0".  This is un-doctest-like, but on balance makes it much
more pleasant to write doctests that pass under 2.2 and 2.3.  I expect
it to go away again, when 2.2 is forgotten.  In the meantime, there's
a new doctest module constant that can be passed to a new optional
argument, if you want to turn this behavior off.

Note that this substitution is very simple-minded:  the expected and
actual outputs have to consist of single tokens.  No attempt is made,
e.g., to accept [True, False] when a test expects [1, 0].  This is a
simple hack for simple tests, and I intend to keep it that way.


Index: NEWS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
retrieving revision 1.789
retrieving revision 1.790
diff -C2 -d -r1.789 -r1.790
*** NEWS	22 Jun 2003 01:42:19 -0000	1.789
--- NEWS	27 Jun 2003 20:48:05 -0000	1.790
***************
*** 84,87 ****
--- 84,95 ----
  -------
  
+ - For compatibility with doctests created before 2.3, if an expected
+   output block consists solely of "1" and the actual output block
+   consists solely of "True", it's accepted as a match; similarly
+   for "0" and "False".  This is quite un-doctest-like, but is practical.
+   The behavior can be disabled by passing the new doctest module
+   constant DONT_ACCEPT_TRUE_FOR_1 to the new optionflags optional
+   argument.
+ 
  - The cgitb module has been extended to support plain text display (SF patch
    569574).