Ticket #12856: trac_12856_multiline_doctests.patch

File trac_12856_multiline_doctests.patch, 1016 bytes (added by dkrenn, 9 years ago)
  • sage-doctest

    # HG changeset patch
    # User Daniel Krenn <math@danielkrenn.at>
    # Date 1334785322 -7200
    # Node ID 2dc2968e2b646013eb0cec8d23f6d4dc5f8d12e3
    # Parent  e1e1b880a03cfbad4120e0a202a55bb9ffe4e44d
    Trac 12856: multiline doctests starting with '....:'
    
    diff --git a/sage-doctest b/sage-doctest
    a b  
    277277    """
    278278    Run the preparser on the documentation string s.
    279279    This *only* preparses the input lines, i.e., those
    280     that begin with "sage:".or with "..."
     280    that begin with "sage:", or with "..." or "....:".
    281281    """
    282282    sl = s.lower()
    283283
     
    340340                line += "\n>>> check_with_tolerance('''"
    341341            t.append(line)
    342342           
     343        elif begin.startswith('....:'):
     344            comment = last_prompt_comment
     345            i = L.find('.')
     346            t.append(L[:i] + '...' + sage.misc.preparser.preparse(L[i+5:]))
     347
    343348        elif begin.startswith('...'):
    344349            comment = last_prompt_comment
    345350            i = L.find('.')