On Jan 15, 4:13 pm, Florent Hivert <florent.hiv...@univ-rouen.fr>
wrote:
>       Hi there,
>
> I'm currently preparing a few of demo for sage days 28. I'm using .rst file
> for the demo. Indeed, compared to notebook it can be edited by hand, and it
> allows easier distribution and versioning. However I'm having trouble with
> sage -t. Suppose I'm writing the following .rst file
>
> """
> Examples of code::
>
>     sage: el = 1
>     sage: el
>     1
>
> Some explanations::
>
>     sage: el
>     1
> """
>
> Then launching sage -t give the following error on the second example:
>
>     sage: el
>     NameError: name 'el' is not defined
>
> It seems that it forget the variables at each new block of code. Is this
> behavior normal ? Intended ? Or a bug ?

Yes, yes, and no.

> Isn't a .rst file considered as a big docstring by the tester ?

No.

Before the second code block, you need a "link" directive to tell it
that it should be connected with the previous block.  See

<http://sagemath.org/doc/developer/conventions.html#testing-rest-
documentation>

for documentation.  For an example, see the file "interfaces.rst" in
the tutorial.  Your example could look like this:


Examples of code::

    sage: el = 1
    sage: el
    1

Some explanations:

.. link

::

    sage: el
    1

(Note the double colon after ".. link", so only a single colon after
"Some explanations".)

--
John

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to