#10589: sage -fixdoctests doesn't work correctly
---------------------------------+------------------------------------------
       Reporter:  mderickx       |         Owner:  mvngu       
           Type:  defect         |        Status:  needs_review
       Priority:  minor          |     Milestone:  sage-5.8    
      Component:  doctest        |    Resolution:              
       Keywords:  sage45         |   Work issues:              
Report Upstream:  N/A            |     Reviewers:              
        Authors:  Andrew Mathas  |     Merged in:              
   Dependencies:                 |      Stopgaps:              
---------------------------------+------------------------------------------
Description changed by andrew.mathas:

Old description:

> To reproduce this remove all but the first test result from the patch at:
> #10568
>
> {{{
> maarten-derickxs-macbook-pro:sage maarten$ sage -t
> matrix/matrix_sparse.pyx
> sage -t  "devel/sage-main/sage/matrix/matrix_sparse.pyx"
> **********************************************************************
> File "/Applications/sage-4.6.rc0/devel/sage-
> main/sage/matrix/matrix_sparse.pyx", line 301:
>     sage: (2/3)*M
> Expected nothing
> Got:
>     [   0  2/3  4/3    2  8/3 10/3]
>     [   4 14/3 16/3    6 20/3 22/3]
>     [   8 26/3 28/3   10 32/3 34/3]
> **********************************************************************
> File "/Applications/sage-4.6.rc0/devel/sage-
> main/sage/matrix/matrix_sparse.pyx", line 302:
>     sage: 7*M
> Expected nothing
> Got:
>     [  0   7  14  21  28  35]
>     [ 42  49  56  63  70  77]
>     [ 84  91  98 105 112 119]
> **********************************************************************
> File "/Applications/sage-4.6.rc0/devel/sage-
> main/sage/matrix/matrix_sparse.pyx", line 303:
>     sage: (1/4)*M
> Expected nothing
> Got:
>     [   0  1/4  1/2  3/4    1  5/4]
>     [ 3/2  7/4    2  9/4  5/2 11/4]
>     [   3 13/4  7/2 15/4    4 17/4]
> **********************************************************************
> File "/Applications/sage-4.6.rc0/devel/sage-
> main/sage/matrix/matrix_sparse.pyx", line 306:
>     sage: m==(97/42)*(42/97*m)
> Expected nothing
> Got:
>     True
> **********************************************************************
> 1 items had failures:
>    4 of   9 in __main__.example_6
> ***Test Failed*** 4 failures.
> For whitespace errors, see the file
> /Users/maarten/.sage//tmp/.doctest_matrix_sparse.py
>          [12.5 s]
>
> ----------------------------------------------------------------------
> The following tests failed:
>

>         sage -t  "devel/sage-main/sage/matrix/matrix_sparse.pyx"
> Total time for all tests: 12.6 seconds
> maarten-derickxs-macbook-pro:sage maarten$ sage -fixdoctests
> matrix/matrix_sparse.pyx
> }}}
>
> The bug was caused by the script not not allowing for the cases when
> either the expected or computed returns from the doctests were empty. The
> attached patch does this properly and also cleans up the script a little.
>
> Note that the script lives in $SAGE_ROOT/local/bin which is probably not
> part of the standard repository. As this is a script run by sage, rather
> than a part of the sage library, I don't see anyway to doc-test it.
> **Apply:** trac_10589--fixdoctest_failures-am.patch

New description:

 To reproduce this remove all but the first test result from the patch at:
 #10568

 {{{
 maarten-derickxs-macbook-pro:sage maarten$ sage -t
 matrix/matrix_sparse.pyx
 sage -t  "devel/sage-main/sage/matrix/matrix_sparse.pyx"
 **********************************************************************
 File "/Applications/sage-4.6.rc0/devel/sage-
 main/sage/matrix/matrix_sparse.pyx", line 301:
     sage: (2/3)*M
 Expected nothing
 Got:
     [   0  2/3  4/3    2  8/3 10/3]
     [   4 14/3 16/3    6 20/3 22/3]
     [   8 26/3 28/3   10 32/3 34/3]
 **********************************************************************
 File "/Applications/sage-4.6.rc0/devel/sage-
 main/sage/matrix/matrix_sparse.pyx", line 302:
     sage: 7*M
 Expected nothing
 Got:
     [  0   7  14  21  28  35]
     [ 42  49  56  63  70  77]
     [ 84  91  98 105 112 119]
 **********************************************************************
 File "/Applications/sage-4.6.rc0/devel/sage-
 main/sage/matrix/matrix_sparse.pyx", line 303:
     sage: (1/4)*M
 Expected nothing
 Got:
     [   0  1/4  1/2  3/4    1  5/4]
     [ 3/2  7/4    2  9/4  5/2 11/4]
     [   3 13/4  7/2 15/4    4 17/4]
 **********************************************************************
 File "/Applications/sage-4.6.rc0/devel/sage-
 main/sage/matrix/matrix_sparse.pyx", line 306:
     sage: m==(97/42)*(42/97*m)
 Expected nothing
 Got:
     True
 **********************************************************************
 1 items had failures:
    4 of   9 in __main__.example_6
 ***Test Failed*** 4 failures.
 For whitespace errors, see the file
 /Users/maarten/.sage//tmp/.doctest_matrix_sparse.py
          [12.5 s]

 ----------------------------------------------------------------------
 The following tests failed:


         sage -t  "devel/sage-main/sage/matrix/matrix_sparse.pyx"
 Total time for all tests: 12.6 seconds
 maarten-derickxs-macbook-pro:sage maarten$ sage -fixdoctests
 matrix/matrix_sparse.pyx
 }}}

 The bug was caused by the script not not allowing for the cases when
 either the expected or computed returns from the doctests were empty. The
 attached patch does this properly and also cleans up the script a little.

 Note that the script lives in $SAGE_ROOT/local/bin which is probably not
 part of the standard repository. As this is a script run by sage, rather
 than a part of the sage library, I don't see any way to doc-test it.

 **Apply:** trac_10589--fixdoctest_failures-am.patch

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10589#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" 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-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to