Repository: scikit-learn/scikit-learn
File: sklearn/utils/estimator_checks.py (Python)

Code before:
        yield check_non_transformer_estimators_n_iter


def _yield_outliers_checks(estimator):
    # checks for the contamination parameter
    if hasattr(estimator, "contamination"):
        yield check_outlier_contamination

    # checks for outlier detectors that have a fit_predict method
    if hasattr(estimator, "fit_predict"):
        yield check_outliers_fit_predict

    # checks for estimators that can be used on a test set
    if hasattr(estimator, "predict"):
        yield check_outliers_train
        yield partial(check_outliers_train, readonly_memmap=True)
        # test outlier detectors can handle non-array data
        yield check_classifier_data_not_an_array
    yield check_non_transformer_estimators_n_iter


def _yield_array_api_checks(estimator, only_numpy=False):
    if only_numpy:
        # Enabling array API dispatch and feeding the NumPy inputs should yield
        # consistent results, even if estimator does not explicitly support
        # array API.
        yield partial(
            check_array_api_input,
            array_namespace="numpy",
            expect_only_array_outputs=False,
        )
    else:
        # These extended checks should pass for all estimators that declare
        # array API support in their tags.
        for (
            array_namespace,
            device,
            dtype_name,
        ) in yield_namespace_device_dtype_combinations():
            yield partial(
                check_array_api_input,
                array_namespace=array_namespace,
                dtype_name=dtype_name,
                device=device,
            )


def _yield_all_checks(estimator, legacy: bool):
    name = estimator.__class__.__name__
    tags = get_tags(estimator)
    if not tags.input_tags.two_d_array:

Review comment (suggestion):
```suggestion
        # Enabling array API dispatch and using NumPy inputs should not
        # change results, even if the estimator does not explicitly support
        # array API.
```

Code after:
        yield check_non_transformer_estimators_n_iter


def _yield_outliers_checks(estimator):
    # checks for the contamination parameter
    if hasattr(estimator, "contamination"):
        yield check_outlier_contamination

    # checks for outlier detectors that have a fit_predict method
    if hasattr(estimator, "fit_predict"):
        yield check_outliers_fit_predict

    # checks for estimators that can be used on a test set
    if hasattr(estimator, "predict"):
        yield check_outliers_train
        yield partial(check_outliers_train, readonly_memmap=True)
        # test outlier detectors can handle non-array data
        yield check_classifier_data_not_an_array
    yield check_non_transformer_estimators_n_iter


def _yield_array_api_checks(estimator, only_numpy=False):
    if only_numpy:
        # Enabling array API dispatch and using NumPy inputs should not
        # change results, even if the estimator does not explicitly support
        # array API.
        yield partial(
            check_array_api_input,
            array_namespace="numpy",
            expect_only_array_outputs=False,
        )
    else:
        # These extended checks should pass for all estimators that declare
        # array API support in their tags.
        for (
            array_namespace,
            device,
            dtype_name,
        ) in yield_namespace_device_dtype_combinations():
            yield partial(
                check_array_api_input,
                array_namespace=array_namespace,
                dtype_name=dtype_name,
                device=device,
            )


def _yield_all_checks(estimator, legacy: bool):
    name = estimator.__class__.__name__
    tags = get_tags(estimator)
    if not tags.input_tags.two_d_array: