Sphinx Doctest: test the code without comparing the output.

Ned Batchelder ned at nedbatchelder.com
Sun Sep 22 09:39:07 EDT 2013


On 9/22/13 12:09 AM, Luca Cerone wrote:
> Hi Chris,
> actually my priority is to check that the code is correct. I changed the syntax
> during the development, and I want to be sure that my tutorial is up to date.
>

If you do manage to ignore the output, how will you know that the syntax 
is correct?  The output for an incorrect syntax line will be an 
exception, which you'll ignore.  Maybe I don't know enough about the 
details of doctest.  It's always seemed incredibly limited to me.  
Essentially, it's as if you used unittest but the only assertion you're 
allowed to make is self.assertEqual(str(X), "....")

--Ned.



More information about the Python-list mailing list