-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
TST replace assert_raises by pytest.raises in test_least_angle, test_omp, test_test_theil_sen #19406
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
TST replace assert_raises by pytest.raises in test_least_angle, test_omp, test_test_theil_sen #19406
Changes from all commits
e3a240f
10eaca6
b64bb2e
68c9aa3
b2a4ef6
957ae4b
7afbd1e
d903625
08190c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
import numpy as np | ||
import pytest | ||
|
||
from sklearn.utils._testing import assert_raises | ||
from sklearn.utils._testing import assert_array_equal | ||
from sklearn.utils._testing import assert_array_almost_equal | ||
from sklearn.utils._testing import ignore_warnings | ||
|
@@ -33,16 +32,16 @@ | |
|
||
def test_correct_shapes(): | ||
assert (orthogonal_mp(X, y[:, 0], n_nonzero_coefs=5).shape == | ||
(n_features,)) | ||
(n_features,)) | ||
assert (orthogonal_mp(X, y, n_nonzero_coefs=5).shape == | ||
(n_features, 3)) | ||
(n_features, 3)) | ||
|
||
|
||
def test_correct_shapes_gram(): | ||
assert (orthogonal_mp_gram(G, Xy[:, 0], n_nonzero_coefs=5).shape == | ||
(n_features,)) | ||
(n_features,)) | ||
assert (orthogonal_mp_gram(G, Xy, n_nonzero_coefs=5).shape == | ||
(n_features, 3)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's ok for this time, but next time please try to refrain to change the formatting of the lines that are fare away from the real changes of your PR to keep the review focused on the main topic (and keep the git history meaningful). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I apologize, I have a lot to learn and I appreciate your time and effort. Thank you for the valuable feedback |
||
(n_features, 3)) | ||
|
||
|
||
def test_n_nonzero_coefs(): | ||
|
@@ -88,15 +87,14 @@ def test_unreachable_accuracy(): | |
n_nonzero_coefs=n_features)) | ||
|
||
|
||
def test_bad_input(): | ||
assert_raises(ValueError, orthogonal_mp, X, y, tol=-1) | ||
assert_raises(ValueError, orthogonal_mp, X, y, n_nonzero_coefs=-1) | ||
assert_raises(ValueError, orthogonal_mp, X, y, | ||
n_nonzero_coefs=n_features + 1) | ||
assert_raises(ValueError, orthogonal_mp_gram, G, Xy, tol=-1) | ||
assert_raises(ValueError, orthogonal_mp_gram, G, Xy, n_nonzero_coefs=-1) | ||
assert_raises(ValueError, orthogonal_mp_gram, G, Xy, | ||
n_nonzero_coefs=n_features + 1) | ||
@pytest.mark.parametrize("positional_params", [(X, y), (G, Xy)]) | ||
@pytest.mark.parametrize( | ||
"keyword_params", | ||
[{"tol": -1}, {"n_nonzero_coefs": -1}, {"n_nonzero_coefs": n_features + 1}] | ||
) | ||
def test_bad_input(positional_params, keyword_params): | ||
with pytest.raises(ValueError): | ||
orthogonal_mp(*positional_params, **keyword_params) | ||
|
||
|
||
def test_perfect_signal_recovery(): | ||
|
Uh oh!
There was an error while loading. Please reload this page.