John
Remember that bug with absolute paths and "sage -t" that David
Loeffler mentioned recently? Well in sage-3.4.1.alpha0, at least, if
you doctest foo.py outside the tree, then "from foo import *" is done
first. E.g.,
wstein@sage:~/build/sage-3.4.1.alpha0$ more a.py
def f(n):
"""
sage: print f(3)
5
"""
return 4
wstein@sage:~/build/sage-3.4.1.alpha0$ ./sage -t a.py
sage -t "a.py"
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.alpha0/a.py", line 3:
sage: print f(3)
Expected:
5
Got:
4
**********************************************************************
1 items had failures:
1 of 3 in __main__.example_0
***Test Failed*** 1 failures.
For whitespace errors, see the file ./.doctest_a.py
[1.0 s]
exit code: 1024
----------------------------------------------------------------------
The following tests failed:
sage -t "a.py"
Total time for all tests: 1.0 seconds
wstein@sage:~/build/sage-3.4.1.alpha0$
Notice above that f *is* defined!
william
> Remember that bug with absolute paths and "sage -t" that David
> Loeffler mentioned recently? Well in sage-3.4.1.alpha0, at least, if
> you doctest foo.py outside the tree, then "from foo import *" is done
> first. E.g.,
Please have a look at <http://wiki.sagemath.org/combinat/HelpOnTheDoc>
In particular, I tried to address this question in
4. 1.: How to use "sage -t" outside sage tree
It seems that you last comment shows that my page is outdated. If so please
correct the page or tell me how to do it.
By the way, since they are a lot of people asking question about the doc, this
page should definitely by more apparent. Here is an excerpt of the page:
It has been said on the mailing list that this page is of general interest
for the sage community and should not stay hidden inside combinat. I would
be happy to move it elsewhere, if someone suggest me a proper place and
from where to link it. If you move it, please don't forget to update the
link at the bottom of the sage-combinat home page -- Florent.
I would be happy to address this question if someone answer.
Or I can remain the only reader of this page :) Or maybe it's the page is only
wrong... If so please tell me.
Cheers,
Florent
> That page looks very useful -- why not move it so that it is not under combinat?
[...]
> > By the way, since they are a lot of people asking question about the doc, this
> > page should definitely by more apparent. Here is an excerpt of the page:
> >
> > It has been said on the mailing list that this page is of general interest
> > for the sage community and should not stay hidden inside combinat. I would
> > be happy to move it elsewhere, if someone suggest me a proper place and
> > from where to link it. If you move it, please don't forget to update the
> > link at the bottom of the sage-combinat home page -- Florent.
> >
> > I would be happy to address this question if someone answer.
... :)
Cheers,
Florent
> personally, I would have searched the "Sage Developers Guide" for
> information on how "sage -t" works. And if there is nothing to find,
> I'd look directly at the code (.../local/bin/sage-test).
So would I. The wiki is only temporary... See my comments below.
> Admittedly, I
> rarely use the Wiki, because I do not feel comfortable with it --- nor
> do I always have internet access when working with Sage.
>
> But a local Sage install does include a lot of eye-candy documentation
> I like to use.
>
> Proposal:
> Do move (better still: copy) the contents of your Wiki-entry to the
> "Sage Developers Guide".
That's the ultimate goal. However, I don't have a broad view of the doc
system. Right now the page is a only a bunch of tips and tricks gathered on
irc and this very mailing list. It is not at all in a stable state and I don't
feel expert enough to write such a text in the guide, not speaking about my
bad English. In particular, I'd like some expert of the build system and
ReST/sphinx to check that the tips I give are correct. Moreover, aside for the
tricks in my opinion the most important thing on the page are link to short
and extended description on the format that I don't want to (even can't ?)
copy in the Devel Guide.
I was hoping that starting the wiki page, I could get some help on expanding
it, or at least get some re-reader. I have chosen the wiki as a communication
mean to build such a doc because anyone can edit and improve it. But it seems
that as a consequence no-one does :) The trac / patch system seems not to be
interactive enough... Any suggestion ?
Cheers,
Florent
What about?:
masgaj@host-56-150%cd /home/masgaj/sage
masgaj@host-56-150%sage -t egros.py
You can't specify paths in python imports even though it feels like a logical
thing to do. Perhaps 'sage -t' should handle a full path name by doing
a 'cd' and trimming the path off the file name.
--
Joel
Yes. The "sage -t foo.py" thing only does "from foo import *" -- it
doesn't import the whole Sage library too. Maybe it should? That
would be easy to add, I think.
William
>
> Yes. The "sage -t foo.py" thing only does "from foo import *" -- it
> doesn't import the whole Sage library too. Maybe it should? That
> would be easy to add, I think.
Perhaps not, as people might want to test python stuff without importing sage?
Incidentally I started out giving this file the suffix .sage instead
of .py. Like that, you do not need to add the exatr import line, but
you do get a warning:
/local/jec/sage-3.4.1.alpha0/local/bin/sage-preparse: File file_name is missing
which seems harmless. The (only) reason I switched to a .py suffix
was that I could not get sage-mode to work in emacs....but that is a
different thread!
John
>
> William
Please explain.
Nick
+1 on making sage -t my_file.py work with minimal hassle.
Jason
>
> 2009/4/1 Nick Alexander <ncale...@gmail.com>:
>>
>>> which seems harmless. The (only) reason I switched to a .py suffix
>>> was that I could not get sage-mode to work in emacs....but that is a
>>> different thread!
>>
>> Please explain.
>
> I went through various attempts a few days ago.
Could you copy me the output of `M-x version' and tell me what version
of sage-mode you have installed? (It looks like you have not used the
standard spkg install, which should be okay, but...) Also, could you
check the *Messages* buffer after you start up and verify that the
problem really is coming from a sage-*.el file.
Nick
sage-mode inherits from python-mode; if you can't use python-mode (due
to a broken rx module) I can't do much to help you. GNU emacs 21.3 is
relatively old; is there a possibility of upgrading to a 22.x build?
(22.x is considered stable now and offers numerous benefits.)
Nick