Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
4 changes: 4 additions & 0 deletions sklearn/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ def test_check_estimator_generate_only_deprecation():
"ignore:Since version 1.0, it is not needed to import "
"enable_hist_gradient_boosting anymore"
)
# TODO(1.8): remove this filter
@pytest.mark.filterwarnings(
"ignore:Importing from sklearn.utils._estimator_html_repr is deprecated."
)
def test_import_all_consistency():
sklearn_path = [os.path.dirname(sklearn.__file__)]
# Smoke test to check that any name in a __all__ list is actually defined
Expand Down
34 changes: 34 additions & 0 deletions sklearn/utils/_estimator_html_repr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause

import warnings

from ._repr_html.base import _HTMLDocumentationLinkMixin
from ._repr_html.estimator import (
_get_visual_block,
_IDCounter,
_VisualBlock,
_write_estimator_html,
_write_label_html,
estimator_html_repr,
)

__all__ = [
"_HTMLDocumentationLinkMixin",
"_IDCounter",
"_VisualBlock",
"_get_visual_block",
"_write_estimator_html",
"_write_label_html",
"estimator_html_repr",
]

# TODO(1.8): Remove the entire module
warnings.warn(
"Importing from sklearn.utils._estimator_html_repr is deprecated. The tools have "
"been moved to sklearn.utils._repr_html. Be aware that this module is private and "
"may be subject to change in the future. The module _estimator_html_repr will be "
"removed in 1.8.0.",
FutureWarning,
stacklevel=2,
)
21 changes: 21 additions & 0 deletions sklearn/utils/tests/test_estimator_html_repr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause

import importlib
import sys

import pytest


# TODO(1.8): Remove the entire file
def test_estimator_html_repr_warning():
with pytest.warns(FutureWarning):
# Make sure that we check for the warning when loading the module (reloading it
# if needed).
module_name = "sklearn.utils._estimator_html_repr"
if module_name in sys.modules:
importlib.reload(sys.modules[module_name])
else:
importlib.import_module(module_name)

assert sys.modules[module_name] is not None