trouble with error message during doctest

23 views
Skip to first unread message

David Perkinson

unread,
May 26, 2015, 7:11:36 PM5/26/15
to sage-...@googlegroups.com
Could someone help me with the following error message?  I am making a lot of revisions to sandpile.py, and all doctests had passed up until I decided to deprecate some functions.  After that, I needed to add the deprecation warnings to some Examples sections.  I cleared up all those errors and was hoping to get the "All tests passed!" line but got this instead:

=================================

Doctesting 1 file.
sage -t src/sage/sandpiles/sandpile.py
    Error: Source line number found
----------------------------------------------------------------------
sage -t src/sage/sandpiles/sandpile.py  # Source line number found
----------------------------------------------------------------------
Total time for all tests: 30.6 seconds
    cpu time: 0.0 seconds
    cumulative wall time: 0.0 seconds

=================================

Thanks,
David

David Roe

unread,
May 26, 2015, 7:20:53 PM5/26/15
to sage-devel
Not a complete answer, but it's coming from matching the regular expression
re.compile(r"^\s*doctest:[0-9]")
See line 257 of sage/doctest/sources.py
David

--
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 sage-devel+...@googlegroups.com.
To post to this group, send email to sage-...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

John H Palmieri

unread,
May 26, 2015, 7:21:10 PM5/26/15
to sage-...@googlegroups.com
This message apparently means "Doctest contains explicit source line number". Can you provide an example of a doctest you changed when adding the deprecation warnings?

  John

David Perkinson

unread,
May 26, 2015, 7:31:54 PM5/26/15
to sage-...@googlegroups.com
    EXAMPLES::

      sage: S = sandpiles.Complete(4)
      sage: D = SandpileDivisor(S, {0: 0, 1: 0, 2: 8, 3: 0})
      sage: E = SandpileDivisor(S, {0: 2, 1: 2, 2: 2, 3: 2})
      sage: v = firing_vector(S, D, E)
        doctest:...: DeprecationWarning: firing_vector() will soon be removed.  Use SandpileDivisor.is_linearly_equivalent() instead.
        See http://trac.sagemath.org/12345 for details.
        doctest:1: DeprecationWarning: May 25, 2015: Replaced by SandpileDivisor.is_linearly_equivalent.
        See http://trac.sagemath.org/12345 for details.

Here is an example of a way I modified an EXAMPLES section.  When I first ran the doctest it gave errors of the form: expect blah1, got blah2.  In each of these cases, I just replaced blah1 by blah2.

John H Palmieri

unread,
May 26, 2015, 7:36:07 PM5/26/15
to sage-...@googlegroups.com


On Tuesday, May 26, 2015 at 4:31:54 PM UTC-7, David Perkinson wrote:
    EXAMPLES::

      sage: S = sandpiles.Complete(4)
      sage: D = SandpileDivisor(S, {0: 0, 1: 0, 2: 8, 3: 0})
      sage: E = SandpileDivisor(S, {0: 2, 1: 2, 2: 2, 3: 2})
      sage: v = firing_vector(S, D, E)
        doctest:...: DeprecationWarning: firing_vector() will soon be removed.  Use SandpileDivisor.is_linearly_equivalent() instead.
        See http://trac.sagemath.org/12345 for details.
        doctest:1: DeprecationWarning: May 25, 2015: Replaced by SandpileDivisor.is_linearly_equivalent.
        See http://trac.sagemath.org/12345 for details.

Does it help if you replace "doctest:1" with "doctest:..."? Search for other occurrences of 'DeprecationWarning' in the source code, and make yours like more like those. To search:

    sage: search_src('DeprecationWarning')


--
John
 

David Perkinson

unread,
May 26, 2015, 7:36:59 PM5/26/15
to sage-...@googlegroups.com
One more thing: I also replaced each instance of "doctest:858:" with "doctest:...".

David Perkinson

unread,
May 26, 2015, 7:41:01 PM5/26/15
to sage-...@googlegroups.com
Success!

Doctesting 1 file.
sage -t src/sage/sandpiles/sandpile.py
    [871 tests, 29.75 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 30.2 seconds
    cpu time: 18.5 seconds
    cumulative wall time: 29.8 seconds

As advised, I replaced all instances of "doctest:1:" with "doctest:...".  (I had tried "doctest:.:", but that did not work.)

Thanks very much!

John H Palmieri

unread,
May 26, 2015, 8:05:39 PM5/26/15
to sage-...@googlegroups.com


On Tuesday, May 26, 2015 at 4:41:01 PM UTC-7, David Perkinson wrote:
Success!

Doctesting 1 file.
sage -t src/sage/sandpiles/sandpile.py
    [871 tests, 29.75 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 30.2 seconds
    cpu time: 18.5 seconds
    cumulative wall time: 29.8 seconds

As advised, I replaced all instances of "doctest:1:" with "doctest:...".  (I had tried "doctest:.:", but that did not work.)

Right: in doctest results, "..." is a wild card and can match anything. A single dot would have to be matched exactly.

  John

 
Reply all
Reply to author
Forward
0 new messages