On 17/05/2017 14:00, Jeroen Demeyer wrote:
On 2017-05-17 12:19, Vincent Delecroix wrote:
Let me tell that my wish to have another test framework is mostly
organizational. First of all, the code in the docstrings are intended to
be read by users. I think that we would benefit from a clearer
distinction between "illustrative examples" and "tests". This is
currently achieved by EXAMPLES vs TESTS. Secondly, as I started to say
the Sage doctest framework is quite limited.
Here are several reasons:
- random seeds are always the same
That can easily be fixed by explicitly changing the random seed in the
doctest (probably some helper context should be provided for this)
- impossible to have complicated test code
First of all, doctests can contain arbitrary code, so it can be as
complicated as you want.
Second, you could write a dedicated test function like
def complicated_test_function(many, arguments, here):
"""
TESTS:
sage: complicated_test_function(1, 2, 3)
"""
>
This is like a unit test without requiring a new testing framework.
And you want this to appear in the reference manual? Add a useless
function to the Sage library?
- impossible to tune the tests to make it more intensive (let say I
want to run the tests for 1000 inputs rather than 10)
You can run many iterations of the doctests.
How do I run a specific doctest (let say line 135 of
sage/my_module/my_file.py) where "for i in range(10)" is replace by "for
i in range(100)"?
- TESTS part are often unreadable
If the test code is complicated, using a different test framework will
not help. You would just be running the same unreadable code in a
different way.
It could be more readable since it can be orgainzed within classes
class MyTestClass:
parameter1 = xxx
parameter2 = yyy
def _test1(self):
...
def _test2(self):
...
Nobody would write such class inside TESTS blocks.
- `TestSuite(my_object).run()` is not illustrative
I don't understand what you mean with this.
I meant "It does not help a user to read this in the documentation of
the class corresponding to "my_object"."
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.