-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
factorize common tests #406
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
Comments
That the repr actually works, and that we can 'clone' the object. In |
Ok so #893 addressed some of these. Still todo
... |
From #943 (which is a duplicate of this one I guess):
Sparse matrix support testing is done thanks to @GaelVaroquaux. Input validation testing should be good now, too. |
Oh and I don't really know how to see that |
Could we test that by fit ( with x1 ) --> fit ( with x2 ) --> fit ( with x1 ) and making sure 1 and 3 are equal and 1, 2 are not? |
Yeah, that would be possible test, not super strong, though. |
thanks for the response! yeah that seems better... will open a PR... |
Just to bump this up again: Replacing "assert_raises" by "assert_raise_message" or "assert_raises_regexp" in the common tests should be pretty simple if any of the GSoC people are bored ;) |
@amueller, you mean replacing |
Yes he means replacing |
Also sometimes it would be simpler to not use the full error message and use only parts of it like done here. |
Ok, but what I meant was, are we in a way deprecating |
Nope... We just want to assert that the code not only raises a given exception, but also raises the intended error message... This helps in making sure that the test is correct. Say for example
All raise but only the 3rd line along with |
Its also probably a good idea to use |
I was mostly talking about this file: But in general it is a good idea to be explicit about the error messages everywhere. |
Couldn't find any instance of |
Because all the checks are in https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/utils/estimator_checks.py sorry, I should have made that more clear. |
Oops, I should've looked into that long import on Line 31. Replacing. |
Fixed in #4550 |
Easy:
Not so easy:
fit
forgets the previous model if anycheck how classifiers handle only one class being presenttest how models handle non-float input (does uint8 cause overflows?)Things done
We should factorize common tests in a new file
test_common.py
(or maybetest_input.py
?). Things to check:can pickle the objectraise an exception when data contains nansraise an exception for invalid input (e.g.,np.matrix
orsp.csr_matrix
if dense only implementation)raise an exception ifn_features
is not the same infit
andpredict
ortransform
__repr__
andclone
workcheck that we can pickle and unpickle estimators.check that all classifiers have aclasses_
attribute (needs some fixes)Edit by @amueller!
Edit by @GaelVaroquaux on Aug 13th 2014 to reflect progress in the codebase.
The text was updated successfully, but these errors were encountered: