From c7e2a8bbc71431777b56694198460249e8f143a8 Mon Sep 17 00:00:00 2001 From: William de Vazelhes Date: Fri, 5 Jul 2019 17:33:11 +0200 Subject: [PATCH] make check_preprocessor private --- metric_learn/base_metric.py | 4 ++-- test/test_utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/metric_learn/base_metric.py b/metric_learn/base_metric.py index cd1c3c71..570172a9 100644 --- a/metric_learn/base_metric.py +++ b/metric_learn/base_metric.py @@ -51,7 +51,7 @@ def score_pairs(self, pairs): learner is. """ - def check_preprocessor(self): + def _check_preprocessor(self): """Initializes the preprocessor""" if _is_arraylike(self.preprocessor): self.preprocessor_ = ArrayIndexer(self.preprocessor) @@ -92,7 +92,7 @@ def _prepare_inputs(self, X, y=None, type_of_inputs='classic', y: `numpy.ndarray` (optional) The checked input labels array. """ - self.check_preprocessor() + self._check_preprocessor() return check_input(X, y, type_of_inputs=type_of_inputs, preprocessor=self.preprocessor_, diff --git a/test/test_utils.py b/test/test_utils.py index 970b40a1..37abb307 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -779,7 +779,7 @@ class MockMetricLearner(MahalanobisMixin): mock_algo = MockMetricLearner(preprocessor=preprocessor) with pytest.raises(ValueError) as e: - mock_algo.check_preprocessor() + mock_algo._check_preprocessor() assert str(e.value) == ("Invalid type for the preprocessor: {}. You should " "provide either None, an array-like object, " "or a callable.".format(type(preprocessor))) @@ -812,7 +812,7 @@ def test_error_message_t_score_pairs(estimator, _): """ estimator = clone(estimator) set_random_state(estimator) - estimator.check_preprocessor() + estimator._check_preprocessor() triplets = np.array([[[1.3, 6.3], [3., 6.8], [6.5, 4.4]], [[1.9, 5.3], [1., 7.8], [3.2, 1.2]]]) with pytest.raises(ValueError) as raised_err: