]> granicus.if.org Git - python/commit
A hack to ease compatibility with pre-2.3 Pythons: by default, doctest
authorTim Peters <tim.peters@gmail.com>
Fri, 27 Jun 2003 20:48:05 +0000 (20:48 +0000)
committerTim Peters <tim.peters@gmail.com>
Fri, 27 Jun 2003 20:48:05 +0000 (20:48 +0000)
commit6ebe61fa807d250ccab419473abd8d746a932e75
tree18350da8265076dbebafc9fca16fe1b5506f6206
parent6cf26195c6e206cba1bb3ebe554e82ab52304bd5
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.
Doc/lib/libdoctest.tex
Lib/doctest.py
Misc/NEWS