[Zope-dev] patterns for using sphinx with the Zope Toolkit?

Lennart Regebro regebro at gmail.com
Sun Jan 3 16:48:28 EST 2010


On Sun, Jan 3, 2010 at 22:08, Benji York <benji at zope.com> wrote:
> 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

That doesn't work for code that will raise an exception.
Also, if you want to both run a command and make sure it's output is
correct, then you need to do that twice. That means you are in fact
not testing the code that is visible, which defeats the whole purpose
of doctests.

-- 
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64


More information about the Zope-Dev mailing list