Ticket #815 (closed defect: fixed)

Opened 1 year ago

Last modified 5 days ago

[with patch; positive review] doctesting is broken on .sage files

Reported by: dmharvey Assigned to: failure
Priority: major Milestone: sage-3.2.1
Component: doctest Keywords:
Cc:

Description

Running sage -t on a .sage file incorrectly reports that all tests passed in the situation that a line of output is missing in the doctest. For example, the following text, in a .sage file, incorrectly produces "All tests passed!":

def foo():
    r"""                                                                                       
    EXAMPLES:                                                                                  
        sage: foo()                                                                            
        2                                                                                      
        sage: foo()                                                                            
        sage: foo()                                                                            
        2                                                                                      
    """
    return 2

Attachments

trac_815.patch (19.7 kB) - added by anakha on 10/23/2008 07:14:27 PM.
scripts-815.patch (14.8 kB) - added by was on 11/26/2008 11:14:32 PM.
this replaces the above and is a REBASING AGAINST 3.1.2.alpha2.

Change History

10/04/2007 12:48:08 PM changed by mabshoff

  • owner changed from was to failure.
  • component changed from algebraic geometry to doctest.
  • milestone set to sage-2.9.

11/03/2007 08:29:53 AM changed by was

  • milestone changed from sage-2.9.1 to sage-2.8.12.

11/03/2007 04:42:27 PM changed by was

Thoughts:

was-815: That 815 thing is because I have a completely custom script for going through .sage files and extracting docstrings and testing as it goes.
[4:29pm] was-815: That seems dumb now.
[4:29pm] was-815: Much better would be to just doctest the corresponding autogenerated .py file.
[4:30pm] was-815: I.e., (1) generate the.py file, then (2) make sure it has "from a import *" in it (where a.sage is the sage file), then (3) do whatever we do to doctest
[4:30pm] was-815: a .py file.
[4:30pm] was-815: The only other thing is to make sure the line numbers match up.
[4:31pm] was-815: nick -- what do you think of my proposal for #815.
[4:31pm] was-815: Basically, I just want to make it reduce to the case of .py.

11/03/2007 04:44:06 PM changed by was

  • milestone changed from sage-2.8.12 to sage-2.9.

10/23/2008 07:14:27 PM changed by anakha

  • attachment trac_815.patch added.

10/23/2008 07:20:59 PM changed by anakha

  • summary changed from doctesting is broken on .sage files to [with patch; needs review] doctesting is broken on .sage files.

Lost of deleted code, a bit of modification and doctesting for .sage works as well as for the rest.

It's still of limited interest for files that are not part of the sage library, but at least it won't lie about the results anymore

11/26/2008 11:14:32 PM changed by was

  • attachment scripts-815.patch added.

this replaces the above and is a REBASING AGAINST 3.1.2.alpha2.

11/26/2008 11:14:54 PM changed by was

  • summary changed from [with patch; needs review] doctesting is broken on .sage files to [with patch; positive review] doctesting is broken on .sage files.

Looks good. Eliminates cruft.

11/27/2008 11:00:44 PM changed by mabshoff

  • status changed from new to closed.
  • resolution set to fixed.

Merged scripts-815.patch in Sage 3.2.1.rc0