On Wed, Apr 29, 2009 at 9:50 PM, Jonathan Hanke <jonha...@gmail.com> wrote:
> I was wondering if there is a way of passing a doctest which correctly
> raises an exception?  I tried the #random comment, but it doesn't pass with
> this.  I also didn't find anything in the manual at
>
> http://www.sagemath.org/doc/developer/conventions.html?highlight=doctest#documentation-strings
>
> about how to handle this case.  Thanks,

Yes, definitely, you can do that, and it is strongly *encouraged*.  If
you search around docs of other code in Sage you'll see hundreds of
examples.  Here's a typical example:

sage: 1/0
Traceback (most recent call last):
...
ZeroDivisionError: Rational division by zero

Personally, I usually make doctests in the notebok and click on the "Text" link
in the upper right.  It will format the session so it is suitable for doctests.

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to