Sphinx Doctest: test the code without comparing the output.
Luca Cerone
luca.cerone at gmail.com
Sun Sep 22 10:26:41 EDT 2013
On Sunday, 22 September 2013 14:39:07 UTC+1, Ned Batchelder wrote:
> 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.
if the function raises an exception, the test fails, regardless of the output
> Maybe I don't know enough about the
>
> details of doctest. It's always seemed incredibly limited to me.
I agree that has some limitations
>
> Essentially, it's as if you used unittest but the only assertion you're
>
> allowed to make is self.assertEqual(str(X), "....")
>
>
I don't know unittest, is it possible to use it within Sphinx?
>
> --Ned.
More information about the Python-list
mailing list