[sage-devel] Warn about long doctests (#16609 needs review)

2014-07-28 Thread Volker Braun
A small handful of modules takes the majority of the doctest walltime, see 
e.g. this lopsided distribution:


I'm proposing to 

* turn the existing sage -t --warn-long parameter into a warning (instead 
of an error)

* enable it by default with a limit of 60s on a modern computer, adjusted 
for slowness of the computer running the tests.

This is implemented in http://trac.sagemath.org/ticket/16609. Please review.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: hiding doctest in documentation

2014-07-28 Thread William Stein
On Jul 28, 2014 8:47 AM, "Volker Braun"  wrote:
>
> On Monday, July 28, 2014 11:42:05 AM UTC-4, William wrote:
>>
>> That said, there is a ready-made solution [1] for exactly the original
>> question,
>
>
> The TESTS: section does appear in the reference manual, fyi. Its just a
way to separate it off from EXAMPLES:
>

That's annoying.  The entire point of the tests section (which I introduced
in the first place) was to not appear in the ref manual, interactive docs,
etc.  I guess I never got around to implementing that or somebody changed
it.

> Specifically for dictionaries we also have the displayhook sorting by key:
>
> sage: d = {'a':23, 'b':34, 'au':56, 'bbf':234, 'aaa':234}
> sage: str(d)# dict uses internal order
> "{'a': 23, 'bbf': 234, 'aaa': 234, 'b': 34, 'au': 56}"
> sage: d   # displayhook sorts alphabetically
> {'a': 23, 'aaa': 234, 'au': 56, 'b': 34, 'bbf': 234}
>
> --
> You received this message because you are subscribed to the Google Groups
"sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: hiding doctest in documentation

2014-07-28 Thread Volker Braun
On Monday, July 28, 2014 11:42:05 AM UTC-4, William wrote:
>
> That said, there is a ready-made solution [1] for exactly the original 
> question,
>

The TESTS: section does appear in the reference manual, fyi. Its just a way 
to separate it off from EXAMPLES:

Specifically for dictionaries we also have the displayhook sorting by key:

sage: d = {'a':23, 'b':34, 'au':56, 'bbf':234, 'aaa':234}
sage: str(d)# dict uses internal order 
"{'a': 23, 'bbf': 234, 'aaa': 234, 'b': 34, 'au': 56}"
sage: d   # displayhook sorts alphabetically
{'a': 23, 'aaa': 234, 'au': 56, 'b': 34, 'bbf': 234}

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: hiding doctest in documentation

2014-07-28 Thread William Stein
On Mon, Jul 28, 2014 at 8:24 AM, Simon King  wrote:
> Hi Daniel,
>
> On 2014-07-28, Daniel Krenn  wrote:
>> Background: The output of a doctest is a dictionary; therefore there is
>> some uncertainty about the ordering of the entires. To have the
>> dict-output, but get tested as well, I want to do the following:
>>
>> sage: dict = {'a': 'b', 'x': 'y'}  # random
>> {'a': 'b', 'x': 'y'}
>> sage: sorted(dict.iteritems())  # hide doctest
>> [('a', 'b'), ('x', 'y')]
>
> I'd suggest to remove the random test and keep the non-random test in
> the doc. I see no reason for hiding it.
>
> Another possibility to deal with randomness of string representation:
> Explicitly assign the expected result to a variable in the doctest, and
> test for equality (here I assume that you have a function/method
> returning a dictionary. Hence, for testing method "bar" of instance
> "Foo", you could do
>
>   sage: D = {'a': 'b', 'x': 'y'}
>   sage: D == Foo.bar(pi)
>   True
>
> But testing against sorted(dict.iteritems()) is perfectly fine in the
> docs (of course it needs to be the case that the sorting of the
> dictionary keys is non-random).

I agree with Simon -- make the test non-random.

That said, there is a ready-made solution [1] for exactly the original
question, which I'm surprised that neither Volker nor Simon mentioned
[1]:

"A TESTS block (optional), formatted just like EXAMPLES, for
additional tests which should be part of the regression suite but are
not illustrative enough to merit placement in EXAMPLES."

Basically, you put

TESTS::

 sage: 2+2
 4

in your code, and it gets doctested, but doesn't appear in the reference manual.

[1] 
http://www.sagemath.org/doc/developer/coding_basics.html#documentation-strings

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: hiding doctest in documentation

2014-07-28 Thread Simon King
Hi Daniel,

On 2014-07-28, Daniel Krenn  wrote:
> Background: The output of a doctest is a dictionary; therefore there is
> some uncertainty about the ordering of the entires. To have the
> dict-output, but get tested as well, I want to do the following:
>
> sage: dict = {'a': 'b', 'x': 'y'}  # random
> {'a': 'b', 'x': 'y'}
> sage: sorted(dict.iteritems())  # hide doctest
> [('a', 'b'), ('x', 'y')]

I'd suggest to remove the random test and keep the non-random test in
the doc. I see no reason for hiding it.

Another possibility to deal with randomness of string representation:
Explicitly assign the expected result to a variable in the doctest, and
test for equality (here I assume that you have a function/method
returning a dictionary. Hence, for testing method "bar" of instance
"Foo", you could do

  sage: D = {'a': 'b', 'x': 'y'}
  sage: D == Foo.bar(pi)
  True

But testing against sorted(dict.iteritems()) is perfectly fine in the
docs (of course it needs to be the case that the sorting of the
dictionary keys is non-random).

Best regards,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: hiding doctest in documentation

2014-07-28 Thread Volker Braun
On Monday, July 28, 2014 9:42:16 AM UTC-4, Daniel Krenn wrote:
>
> Is there a way to hide a doctest in the documentation, but still keep it 
> in the source, so that it will get tested? 
>

No. It wouldn't be a "doc"test then, would it?
 

> sage: dict = {'a': 'b', 'x': 'y'}  # random 
> {'a': 'b', 'x': 'y'} 
> sage: sorted(dict.iteritems())  # hide doctest 
> [('a', 'b'), ('x', 'y')] 
>


how about

sage: dict ==  {'a': 'b', 'x': 'y'}
True

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] hiding doctest in documentation

2014-07-28 Thread Daniel Krenn
Is there a way to hide a doctest in the documentation, but still keep it
in the source, so that it will get tested?

Background: The output of a doctest is a dictionary; therefore there is
some uncertainty about the ordering of the entires. To have the
dict-output, but get tested as well, I want to do the following:

sage: dict = {'a': 'b', 'x': 'y'}  # random
{'a': 'b', 'x': 'y'}
sage: sorted(dict.iteritems())  # hide doctest
[('a', 'b'), ('x', 'y')]

Best wishes

Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] FiniteStateMachines: naming conventions of classes

2014-07-28 Thread Daniel Krenn
Dear all,

in the finite_state_machine module there exist classes FSMState,
FSMTransition, FSMProcessIterator. The process iterator is to be written
new, see http://trac.sagemath.org/ticket/16538
Thereby, the following questions arose: What are the naming conventions
here w.r.t. the prefix "FSM", i.e., is "ProcessIterator" or
"FSMProcessIterator" better?

FYI: The mentioned classes are not in the gobal namespace (although, the
original motivation for the prefix FSM was that the classes were in the
global namespace. Cf. http://trac.sagemath.org/ticket/15078#comment:9
where it was suggested to avoid putting this into the global namespace)

Best wishes

Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: "Groups" in Sage

2014-07-28 Thread Nathann Cohen
Yo !

> Until all properties of graphs are known to Sage, you should then be
pushing
> to not have any graph in Sage.

...

Okay, when we have reached this level of non-communication there is nothing
to add.

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.