#6357: make sage -t worksheet.sws work
-------------------------+--------------------------------------------------
Reporter: ncalexan | Owner: tbd
Type: enhancement | Status: new
Priority: major | Milestone: sage-feature
Component: doctest | Keywords: sage test worksheet doctest
Reviewer: | Author:
Merged: |
-------------------------+--------------------------------------------------
Comment(by was):
(NOTE -- I rethought this in the last paragraph below, but didn't delete
the stuff above, in case it is useful still.)
How I would implement this:
{{{
sage -t foo.sws
}}}
would
1. extract foo.sws into a temporary directory. Try to use builtin library
calls instead of calling tar on the command line, if possible. Note that
foo.sws is a .tar.bz2
2. Ignore everything not in {{}}'s. I'm using {{ instead of triple {'s to
avoid trac's wiki preformat mode.
3. Create a file foo.py. For each chunk of code
{{{
{{
input lines
///
output lines
}}}
insert into the file foo.py lines:
{{{
sage: sage.server.notebook.cell.eval_for_testing(r"""input lines
input lines...""")
output lines
}}}
since I think how the notebook works is best simulated by using the sage0
pexpect interface (that's what the notebook really uses).
4. Doctest foo.py using {{{sage -t foo.py}}} and let normal doctest report
the results. Possibly postprocess the {{{print sage0.eval(r"""}}} wrapper
crap out of the result.
The above plan has the advantage that it reduces things to the existing
python doctest framework instead of trying to write another doctest
system. One disadvantage is that using sage0 means that two Python
processes are spawned instead of 1.
The function {{{sage.server.notebook.cell.eval_for_testing}}} has not been
written. It would make a blank directory, call sage0.eval -- just like
the notebook does -- then apply all transformations the notebook does on
output.
Actually, writing the above makes me think that this problem is harder
than I thought when I started writing this comment! The problem is the
output is potentially very complicated, since it can be a bunch of
sagexxx.png files, html, etc. Maybe a better approach is to completely
use the notebook codebase -- as is done in all the notebook doctesting --
to run a *copy* of the whole worksheet (a sort of evaluate all) -- then
simply compare the original's output to the copy's.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6357#comment:2>
Sage <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---