On Sat, Jan 2, 2010 at 8:44 PM, Chris McDonough <chr...@plope.com> wrote:
> Python samples in Sphinx docs are generated like so:
>
> .. code-block:: python
>
>     a == 1
>
> I did a bit of fooling around with Manuel, because I wanted to make sure that
> the code blocks in my documentation actually worked, but I wound up in a place
> where I use Manuel to check only the *syntax* of a subets of the Sphinx code
> blocks I use.  It will do this right out of the box if you read the Manuel 
> docs
>  But I couldn't really figure out a way to do the moral equivalent of this:
>
> .. code-block:: python
>
>    a == 1
>
> .. manuel-expect:
>
>    True

Sphinx and Manuel both support interpreter blocks, so the normal
approach will work:

    >>> a == 1
    True

Occasionally you want to show some code but hide the assertions about
the effects of the code.  You can do that by putting the tests in a reST
comment after the code.

.. code-block:: python

    a = Foo()
    b = a.bar()

.. make sure the above worked correctly

    >>> b.baz
    42
-- 
Benji York
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to