-
-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sampling in unit tests #14284
Comments
Dependencies: #14285 |
Author: David Roe |
comment:3
There is a problem with short lists. |
Reviewer: Julian Rueth |
comment:5
Fixed the problem with nth root and with unrank not working correctly. |
comment:6
Attachment: 14284.patch.gz See #14293 for a bug revealed by this ticket. |
This comment has been minimized.
This comment has been minimized.
comment:7
Attachment: trac_14284_review.patch.gz |
comment:9
Hi! Sorry to jump in a bit late in the discussion; I had not noticed this ticket before. I definitely see and approve the point of the ticket. On the other hand, I find the current idiom to be used in
It's short, and encapsulate TestSuite's inner logic for testing strategies (on how many elements to run the tests, whether to do tests at random or not, ...). This of course requires implementing:
The default implementation could be to run XXX.some_elements(). Or iterate through XXX, stopping if there are more than n_max elements. Or take a sample if XXX implements sample. Or ... What do you think? If you agree, then I would suggest doing the changes in this ticket, in order to minimize changes and counter changes (they probably will require some rebasing of my upcoming category patches; the less rebasing the better :-)). By the way: for reproducibility of test failures, I am not super comfortable with random testing as a default; but that might be just me. Cheers, |
comment:10
Replying to @nthiery:
Well, we did just open it a couple days ago (Julian's visiting me in Calgary so we're working in person).
Sounds okay to me: I'll make a new version. There will be a couple tests that can't use this idiom (
Since Sage sets the random seed at the beginning of each run, tests that use randomness should be reproducible.... |
comment:11
Replying to @roed314:
Thanks! By the way: there are quite a few spots where _test_associativity is
You might want to play around with those and maybe fix a couple if
Unless some edit elsewhere in the file changes the order in which But I see the advantages too. |
Attachment: trac_14284_review_review.patch.gz |
This comment has been minimized.
This comment has been minimized.
comment:13
Attachment: trac_14284_fix.patch.gz |
comment:14
[I uploaded the patches, but they were actually written by David Roe] |
Merged: sage-5.9.beta2 |
In writing unit tests (e.g.
_test_associativity
) it can be useful to pass in lots of elements to test. But some tests scale linearly while others scale cubically, so it's not practical to have the same list of elements for all tests. This patch adds amax_runs
option forTestSuite.run
that forces sampling of the element list when a large list is specified.Apply
Depends on #14285
Component: misc
Author: David Roe
Reviewer: Julian Rueth
Merged: sage-5.9.beta2
Issue created by migration from https://trac.sagemath.org/ticket/14284
The text was updated successfully, but these errors were encountered: