On Sun, Jan 3, 2010 at 4:48 PM, Lennart Regebro <rege...@gmail.com> wrote:
> 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
> 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.
In both of those cases normal doctest blocks seem appropriate.
Calling foo with the wrong parameters raises an exception:
Traceback (most recent call last):
ValueError: bad parameters
Calling the hello function prints a greeting.
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -