8000 MAINT Shorten parametrized test names with long error messages by ogrisel · Pull Request #21364 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

MAINT Shorten parametrized test names with long error messages #21364

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

Merged
merged 3 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sklearn/ensemble/tests/test_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,9 @@ def test_forest_degenerate_feature_importances():
r"'\<class 'numpy.ndarray'\>'",
),
],
# Avoid long error messages in test names:
# https://github.com/scikit-learn/scikit-learn/issues/21362
ids=lambda x: x[:10].replace("]", "") if isinstance(x, str) else x,
)
def test_max_samples_exceptions(name, max_samples, exc_type, exc_msg):
# Check invalid `max_samples` values
Expand Down
3 changes: 3 additions & 0 deletions sklearn/ensemble/tests/test_gradient_boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ def test_classification_toy(loss):
({"max_features": -0.1}, r"max_features must be in \(0, n_features\]"),
({"n_iter_no_change": "invalid"}, "n_iter_no_change should either be"),
],
# Avoid long error messages in test names:
# https://github.com/scikit-learn/scikit-learn/issues/21362
ids=lambda x: x[:10].replace("]", "") if isinstance(x, str) else x,
)
@pytest.mark.parametrize(
"GradientBoosting, X, y",
Expand Down
3 changes: 3 additions & 0 deletions sklearn/linear_model/tests/test_sgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ def asgd(klass, X, y, eta, alpha, weight_init=None, intercept_init=0.0):
),
({"n_iter_no_change": 0}, "n_iter_no_change must be >= 1"),
],
# Avoid long error messages in test names:
# https://github.com/scikit-learn/scikit-learn/issues/21362
ids=lambda x: x[:10].replace("]", "") if isinstance(x, str) else x,
)
def test_sgd_estimator_params_validation(klass, fit_method, params, err_msg):
"""Validate parameters in the different SGD estimators."""
Expand Down
0