sage -t problems with semicolons and line breaks

3 views
Skip to first unread message

davidp

unread,
Jun 8, 2009, 12:20:33 PM6/8/09
to sage-support
On the file test.py, consisting of

"""
EXAMPLES::

sage: gcd(4,6);
sage: a = {1:'a',
2:'b'}
"""

running sage -t produces two error messages (see below). Is it true
that sage -t does not recognize semicolons and does not parse line
breaks correctly? (Cutting and pasting the code in the examples into
sage produces no errors.)

Thanks,
Dave





| Sage Version 4.0.alpha0, Release Date: 2009-05-15

sage -t "test.py"
**********************************************************************
File "/home/davidp/math/sandpile/sage/sage-sandpile1.4/test.py", line
4:
sage: gcd(4,6);
Expected nothing
Got:
2
**********************************************************************
File "/home/davidp/math/sandpile/sage/sage-sandpile1.4/test.py", line
5:
e: a = {1:'a',
Exception raised:
Traceback (most recent call last):
File "/home/davidp/download/sage-devel/local/bin/ncadoctest.py",
line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/home/davidp/download/sage-devel/local/bin/
sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example,
filename, compileflags)
File "/home/davidp/download/sage-devel/local/bin/ncadoctest.py",
line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0[3]>", line 1
a = {Integer(1):'a',###line 5:
e: a = {1:'a',

^
SyntaxError: unexpected EOF while parsing
**********************************************************************
1 items had failures:
2 of 4 in __main__.example_0
***Test Failed*** 2 failures.

Carlo Hamalainen

unread,
Jun 9, 2009, 3:34:20 AM6/9/09
to sage-s...@googlegroups.com
On Mon, Jun 8, 2009 at 6:20 PM, davidp<dav...@reed.edu> wrote:
>
> On the file test.py, consisting of
>
> """
>    EXAMPLES::
>
>        sage: gcd(4,6);
>        sage: a = {1:'a',
>                   2:'b'}
> """
>
> running sage -t produces two error messages (see below).  Is it true
> that sage -t does not recognize semicolons and does not parse line
> breaks correctly?  (Cutting and pasting the code in the examples into
> sage produces no errors.)

It seems so, but if you specify the line break using a backslash then
it works ok:

"""
EXAMPLES::
sage: gcd(4,6);
2


sage: a = {1:'a', \
2:'b'}

"""

$ sage -t test.py
sage -t "test.py"
[1.7 s]

----------------------------------------------------------------------
All tests passed!
Total time for all tests: 1.7 seconds


This is a little inconsistent because Python is happy with that line
break without a backslash...


--
Carlo Hamalainen
http://carlo-hamalainen.net

Reply all
Reply to author
Forward
0 new messages