-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[WIP] Some test refactoring #322
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
Conversation
Hello @massich! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on August 18, 2017 at 08:19 Hours UTC |
I am fine with factorizing some tests. I put it WIP. Change to MRG once that you made a pass on the tests which might be factorized. |
1208348
to
bd0981f
Compare
The changed tests are a single test not multiple therefore are written with an assert within a for. Give it a read. cc: @glemaitre |
They were a single test before as well. The difference is that you knew which line was failing but I hope that pytest will tell you the values of |
Codecov Report
@@ Coverage Diff @@
## master #322 +/- ##
=====================================
Coverage 98% 98%
=====================================
Files 66 66
Lines 3860 3860
=====================================
Hits 3783 3783
Misses 77 77 Continue to review full report at Codecov.
|
Just to have it somewhere (do not comment) def test_ncr_check_threshold_cleaning_parameter():
error_regex = "'threshold_cleaning' is a value between 0 and 1"
for th in [-10, 10]:
with raises(ValueError, match=error_regex):
NeighbourhoodCleaningRule(threshold_cleaning=th).fit_sample(X, Y)
for th in [0, 0.2, 1.]:
with raises(None):
NeighbourhoodCleaningRule(threshold_cleaning=th).fit_sample(X, Y) also def test_ratio_minority_under_sampling():
error_regex = "'ratio'='majority' cannot be used with under-sampler."
with raises(ValueError, match=error_regex):
check_ratio('minority', np.array([1, 2, 3]), 'under-sampling')
def test_ratio_majority_over_sampling():
error_regex = "'ratio'='majority' cannot be used with over-sampler."
with raises(ValueError, match=error_regex):
check_ratio('majority', np.array([1, 2, 3]), 'over-sampling') The errors with the following regex |
bf1ec62
to
23ad602
Compare
This PR was a place to play with pytest. But now pytest has been in imbalanced-learn for while. What do you guys want to do with it? BTW, still no consensus regarding |
We should still update the tests such that they are parametrize and use properly pytest. |
Reference Issue
What does this implement/fix? Explain your changes.
Any other comments?