On Tue, Apr 14, 2009 at 11:57 AM, John H Palmieri
<jhpalmier...@gmail.com> wrote:
> I figured out how to fix the problem, although I still don't know why
> adding a docstring should cause it.
>
> To fix it: the docstring for "print_or_typeset" contains the lines
...

Well, I can tell you why adding a docstring will cause the problem.

The Sage doctest system works by translating files with Sage-style
doctests into files with Python-style doctests and then running the
Python doctest system.  (You can see the translated file at
$SAGE_ROOT/tmp/.doctest_latex.py .)

During this translation, the doctests get named example_1 through
example_NN (example_12 in our case).  print_or_typeset ends up being
example_9.

Then the Python doctest system sorts the names ALPHABETICALLY, and
runs them in this order:

example_1
example_10
example_11
example_12
example_2
...
example_9

Adding a new doctest to a function near the beginning of the file
bumps print_or_typeset from example_9 (where it is the last doctest to
be run, so it doesn't affect any other doctests) to example_10 (where
it is the second doctest to be run, and affects almost all the other
doctests).

Probably there should be a way to randomize the doctest order, so we
can verify that it doesn't matter what order they are run in.  I'll
add that to my list of small Sage projects...

Carl

--~--~---------~--~----~------------~-------~--~----~
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