#19503: strip TESTS blocks in introspection
-------------------------------------+-------------------------------------
       Reporter:  jhpalmieri         |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.10
      Component:  documentation      |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  John Palmieri      |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/jhpalmieri/TESTS                 |  c659e025d483d55b4bf644fa2f367884c7a2ca20
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by kcrisman):

 > For some time,
 The
 [https://github.com/sagemath/sage/blob/master/src/sage/calculus/calculus.py
 very first example] I looked at has this problem.
 {{{
 TESTS:
 Substitution::
     sage: f = x
     sage: f(x=5)
     5
 Simplifying expressions involving scientific notation::
     sage: k = var('k')
     sage: a0 = 2e-06; a1 = 12
     sage: c = a1 + a0*k; c
     (2.00000000000000e-6)*k + 12
     sage: sqrt(c)
     sqrt((2.00000000000000e-6)*k + 12)
     sage: sqrt(c^3)
     sqrt(((2.00000000000000e-6)*k + 12)^3)
 The symbolic calculus package uses its own copy of Maxima for
 simplification, etc., which is separate from the default
 system-wide version::
     sage: maxima.eval('[x,y]: [1,2]')
     '[1,2]'
     sage: maxima.eval('expand((x+y)^3)')
     '27'
 If the copy of maxima used by the symbolic calculus package were
 the same as the default one, then the following would return 27,
 which would be very confusing indeed!
 ::
     sage: x, y = var('x,y')
     sage: expand((x+y)^3)
     x^3 + 3*x^2*y + 3*x*y^2 + y^3
 Set x to be 5 in maxima::
     sage: maxima('x: 5')
     5
     sage: maxima('x + x + %pi')
     %pi+10
 Simplifications like these are now done using Pynac::
     sage: x + x + pi
     pi + 2*x
 But this still uses Maxima::
     sage: (x + x + pi).simplify()
     pi + 2*x
 Note that ``x`` is still ``x``, since the
 maxima used by the calculus package is different than the one in
 the interactive interpreter.
 }}}
 and so forth.  Obviously a lot of this is not particularly useful to end
 users, but a lot of this is.  (It also has `TESTS:` and not `TESTS::`
 though presumably that isn't relevant here.)

 More examples:
 *
 [https://github.com/sagemath/sage/blob/master/src/sage/calculus/desolvers.py
 desolvers] I assume this could be useful for some users
 {{{
     TESTS:
     :trac:`9961` fixed (allow assumptions on the dependent variable in
 desolve)::
         sage: y=function('y',x); assume(x>0); assume(y>0)
         sage: sage.calculus.calculus.maxima('domain:real')  # needed since
 Maxima 5.26.0 to get the answer as below
         real
         sage: desolve(x*diff(y,x)-x*sqrt(y^2+x^2)-y == 0, y,
 contrib_ode=True)
         [x - arcsinh(y(x)/x) == _C]
 }}}
 * Presumably the only documentation for this function
 [https://github.com/sagemath/sage/blob/master/src/sage/plot/animate.py
 here]:
 {{{
     def add_frame(self, pngfile, delay=None, delay_denominator=None):
         r"""
         Adds a single frame to the APNG file.
         INPUT:
         - ``pngfile`` -- file name of the PNG file with data for this
 frame
         - ``delay`` -- numerator of the delay fraction in seconds
         - ``delay_denominator`` -- denominator of the delay in seconds
         If the delay is not specified, the default from the constructor
         applies.
         TESTS::
             sage: from sage.plot.animate import APngAssembler
             sage: from StringIO import StringIO
             sage: buf = StringIO()
             sage: apng = APngAssembler(buf, 2)
             sage: fn = APngAssembler._testData("input1", True)
             sage: apng.add_frame(fn, delay=0x567,
 delay_denominator=0x1234)
             sage: fn = APngAssembler._testData("input2", True)
             sage: apng.add_frame(fn)
             sage: len(buf.getvalue())
             217
             sage: buf.getvalue() == APngAssembler._testData("anim12",
 False)
             True
             sage: apng.add_frame(fn)
             Traceback (most recent call last):
             ...
             RuntimeError: Already reached the declared number of frames
 }}}
 * End user discovers something ''very'' useful to know about this method
 [https://github.com/sagemath/sage/blob/master/src/sage/plot/arc.py here]:
 {{{
     def plot3d(self):
         r"""
         TESTS::
             sage: from sage.plot.arc import Arc
             sage: Arc(0,0,1,1,0,0,1,{}).plot3d()
             Traceback (most recent call last):
             ...
             NotImplementedError
         """
         raise NotImplementedError
 }}}
   Yeah, I guess I'd want to know that it isn't implemented...

 My point: there is an awful lot of stuff grandfathered in under this that
 will vanish which might end up giving ask.sagemath a lot more
 (unnecessary) activity.

--
Ticket URL: <http://trac.sagemath.org/ticket/19503#comment:24>
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.

Reply via email to