This is how exceptions are doctested in Python. Your test needs to catch 
the exception if you want to test the additional output. Its obviously a 
terrible ux if you rely on printing stuff before a lengthy traceback.



On Thursday, August 27, 2015 at 1:01:50 PM UTC-4, Daniel Krenn wrote:
>
> Having a doctest 
>
>      sage: def f(): 
>      ....:     print 'Do you see me?' 
>      ....:     raise Exception() 
>      sage: f() 
>      Traceback (most recent call last): 
>      ... 
>      Exception 
>
> But doing it in the terminal gives 
>
> Do you see me? 
> --------------------------------------------------------------------------- 
>
> Exception                                 Traceback (most recent call 
> last) 
> ... 
> Exception: 
>
> So the print statment is printed in the latter but not in the former. Is 
> there a reason for having this as it is? Would it be possible to include 
> print output in doctests as well? 
>
> Best 
>
> Daniel 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to