Opened 8 years ago

Last modified 7 years ago

#12815 closed defect

bugs in doctesting script for examples with tolerance — at Version 2

Reported by: mstreng Owned by: mvngu
Priority: critical Milestone: sage-5.7
Component: doctest coverage Keywords: tolerance doctest
Cc: jhpalmieri, kcrisman Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #12493 Stopgaps:

Description (last modified by jdemeyer)

  1. When testing the file
    """
    EXAMPLES:
    
    The name blah is undefined::
    
        sage: blah+blah
        blahblah
    
    Here's a doctest that is out of tolerance::
    
        sage: 100+10000000000 # abs tol 0.1
        10000000000
        sage: 1+1
        2
    """
    

I get

File "/Users/marcostreng/tmp/test.sage", line 6:
    sage: blah+blah
Out of tolerance 10000000000.0 vs 10000000100.0

So the error of "blah is undefined" is not printed, while the "out of tolerance" is printed for the wrong test.

  1. Also, there is a bug when a test with tolerance is the last test:
    """
    EXAMPLES:
    
    Doctests with tolerance cannot be followed by empty lines::
    
        sage: 100+10000000000 # rel tol 0.1
        10000000000
    """
    

yields

  File "/Users/marcostreng/.sage//tmp/test_71331.py", line 58
    ... ''', res, 0.1, 're
    ^
SyntaxError: invalid syntax
  1. The following fails but should succeed (and is documented as such):
    """
    sage: 1e16     # relative tol 1e-10
    10^16
    
    """
    

Testing this gives

sage -t  "/home/jdemeyer/doctest/tolerance_fail.py"
**********************************************************************
File "/home/jdemeyer/doctest/tolerance_fail.py", line 2:
    sage: 1e16     # relative tol 1e-10
Expected '
    10^16
    ' got '1.00000000000000e16'
**********************************************************************

Change History (2)

comment:1 Changed 8 years ago by jhpalmieri

  • Cc jhpalmieri added

comment:2 Changed 8 years ago by jdemeyer

  • Dependencies changed from 12493 to #12493
  • Description modified (diff)
  • Priority changed from major to critical
Note: See TracTickets for help on using tickets.