doctests compatibility for python 2 & python 3

Terry Reedy tjreedy at udel.edu
Fri Jan 17 16:10:50 EST 2014


On 1/17/2014 7:14 AM, Robin Becker wrote:

> I tried this approach with a few more complicated outcomes and they fail
> in python2 or 3 depending on how I try to render the result in the doctest.

I never got how you are using doctests. There were certainly not meant 
for heavy-duty unit testing, but for testing combined with explanation. 
Section 26.2.3.7. (in 3.3) Warnings warns that they are fragile to even 
single char changes and suggests == as a workaround, as 'True' and 
'False' will not change. So I would not reject that option.

-- 
Terry Jan Reedy




More information about the Python-list mailing list