I think I am missing something about the sphinx extension for doctest.
A typical example in the documentation:
.. doctest:: >>> print 1 1
Is there a way to let sphinx generate output (here: 1
) automatically?
As I understand it, you can run:
$ make doctest
which allows you to check code fragments and compare the actual output with the expected output. For example, if you have
.. doctest:: >>> print 1 3
doctest will warn you that you received 1
, expecting 3
.
Instead, I would like sphinx to embed real output only in my docstring or in my .rst file. For example, if we have something like:
.. doctest:: >>> print 1 >>> print [2*x for x in range(3)]
I would like it to change docstring to when running make doctest
with an option:
.. doctest:: >>> print 1 1 >>> print [2*x for x in range(3)] [0,2,4]
I am sure that this is possible and would be very convenient!
source share