On Sun, Jan 3, 2010 at 22:08, Benji York <be...@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
_______________________________________________
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