On Sat, Nov 28, 2009 at 02:38:35PM -0800, William Cauchois wrote:
> Original author of the patch here. I took some time to look at this
> today and found that the doctesting bug was due to reading the value
> of sys.stdout only once in install(); during doctesting, sys.stdout is
> reset some time after install() is called, presumably to redirect
> output back to the doctesting mechanism.
> 
> I fixed this bug and restructured the code by moving it out of a class
> (since the single instance variable was no longer needed) in a new
> patch which I've uploaded to #1918. Unless we find any more bugs with
> the displayhook, the only problem that remains is that of updating the
> doctests where a list of matrices is output.

As said Florent: THANKS! That's one of those little things that have a
big practical impact.

> Back when I was working on this, my approach to fixing the doctests
> relied upon an automatic solution. William had told me about this
> nifty little tool called sage -fixdoctests that looked at the output
> of a test run and spliced the output from the "Expected:" section back
> into the original source code so that it would pass the doctest. The
> problem was, sage -fixdoctests couldn't handle multiline output from a
> test case, which are exactly the types of outputs that will be
> affected by the displayhook. I spent some time writing a tool that
> could handle multiline outputs based on sage -fixdoctests, but even
> though it should be really simple I kept making off by one errors :).
> 
> As soon as I get back home to my external HD, I can post the source of
> that incomplete tool. I will take a look and see if I can fix it,
> because I think that a fixed sage -fixdoctests would be a valuable
> resource to the Sage community.

For the record: there is a patch of mine on trac with sage
-fixdoctests improvements, in particular for multiline output (sorry,
I am in the train, and unable to look up the ticket number). By
accident it did not get merged earlier, but will definitely be in sage
4.3. Feedback and further improvements are most welcome!

Cheers,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

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

Reply via email to