#19088: multi-line doctests fail when using angle notation (preparser)
-------------------------------------+------------------------
Reporter: dkrenn | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.9
Component: doctest framework | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------------+------------------------
Comment (by nbruin):
Perhaps a simpler example: compare
{{{
sage: preparse("""A.<a,b,c>=PolynomialRing(QQ)""")
"A = PolynomialRing(QQ, names=('a', 'b', 'c',)); (a, b, c,) =
A._first_ngens(3)"
sage: preparse("""A.<a,b,c>=PolynomialRing(QQ\n)""")
'A = PolynomialRing(QQ; (a, b, c,) = A._first_ngens(3)\n)'
sage: preparse("A.<x>=QQ[]")
"A = QQ['x']; (x,) = A._first_ngens(1)"
sage: preparse("A.<x>=QQ[\n]")
'A = QQ[; (x,) = A._first_ngens(1)\n]'
}}}
As you can see, the newline completely throws off the substitution:
- no "names" attribute is inserted
- the binding of generators to given identifiers is inserted in the wrong
spot (at the end of the first line instead of at the end of the command)
This is a tricky one: Usually in python, a newline terminates a command,
so the place of insertion would usually be safe. However, if there is an
unbalanced bracket, then the newline is just a whitespace. This is a
condition that cannot be detected with a regex in general.
--
Ticket URL: <http://trac.sagemath.org/ticket/19088#comment:1>
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.
For more options, visit https://groups.google.com/d/optout.