Skip to content

Commit 89841a7

Browse files
committed
add test
1 parent 7e0abe5 commit 89841a7

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

sklearn/tests/test_common.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,3 +460,44 @@ def test_estimators_do_not_raise_errors_in_init_or_set_params(Estimator):
460460

461461
# Also do does not raise
462462
est.set_params(**new_params)
463+
464+
465+
# TODO: remove this filter in 1.2
466+
@pytest.mark.filterwarnings("ignore::FutureWarning:sklearn")
467+
@pytest.mark.parametrize(
468+
"Estimator",
469+
[
470+
AffinityPropagation,
471+
Birch,
472+
MeanShift,
473+
KNeighborsClassifier,
474+
KNeighborsRegressor,
475+
RadiusNeighborsClassifier,
476+
RadiusNeighborsRegressor,
477+
LabelPropagation,
478+
LabelSpreading,
479+
OPTICS,
480+
SpectralClustering,
481+
LocalOutlierFactor,
482+
LocallyLinearEmbedding,
483+
Isomap,
484+
TSNE,
485+
],
486+
)
487+
def test_f_contiguous_array_estimator(Estimator):
488+
# Non-regression test for:
489+
# https://github.com/scikit-learn/scikit-learn/issues/23988
490+
# https://github.com/scikit-learn/scikit-learn/issues/24013
491+
492+
X, _ = make_blobs(n_samples=80, n_features=4, random_state=0)
493+
X = np.asfortranarray(X)
494+
y = np.round(X[:, 0])
495+
496+
est = Estimator()
497+
est.fit(X, y)
498+
499+
if hasattr(est, "transform"):
500+
est.transform(X)
501+
502+
if hasattr(est, "predict"):
503+
est.predict(X)

0 commit comments

Comments
 (0)