|
7 | 7 | from scipy import sparse
|
8 | 8 | import pytest
|
9 | 9 |
|
10 |
| -from sklearn.exceptions import NotFittedError |
11 | 10 | from sklearn.utils.testing import assert_array_equal
|
12 | 11 | from sklearn.utils.testing import assert_equal
|
13 | 12 | from sklearn.utils.testing import assert_raises
|
@@ -251,28 +250,6 @@ def test_one_hot_encoder_handle_unknown():
|
251 | 250 | assert_raises(ValueError, oh.fit, X)
|
252 | 251 |
|
253 | 252 |
|
254 |
| -def test_one_hot_encoder_not_fitted(): |
255 |
| - X = np.array([['a'], ['b']]) |
256 |
| - enc = OneHotEncoder(categories=['a', 'b']) |
257 |
| - msg = ("This OneHotEncoder instance is not fitted yet. " |
258 |
| - "Call 'fit' with appropriate arguments before using this method.") |
259 |
| - with pytest.raises(NotFittedError, match=msg): |
260 |
| - enc.transform(X) |
261 |
| - |
262 |
| - |
263 |
| -def test_one_hot_encoder_no_categorical_features(): |
264 |
| - X = np.array([[3, 2, 1], [0, 1, 1]], dtype='float64') |
265 |
| - |
266 |
| - cat = [False, False, False] |
267 |
| - enc = OneHotEncoder(categorical_features=cat) |
268 |
| - with ignore_warnings(category=(DeprecationWarning, FutureWarning)): |
269 |
| - X_tr = enc.fit_transform(X) |
270 |
| - expected_features = np.array(list(), dtype='object') |
271 |
| - assert_array_equal(X, X_tr) |
272 |
| - assert_array_equal(enc.get_feature_names(), expected_features) |
273 |
| - assert enc.categories_ == [] |
274 |
| - |
275 |
| - |
276 | 253 | @pytest.mark.parametrize("output_dtype", [np.int32, np.float32, np.float64])
|
277 | 254 | @pytest.mark.parametrize("input_dtype", [np.int32, np.float32, np.float64])
|
278 | 255 | def test_one_hot_encoder_dtype(input_dtype, output_dtype):
|
|
0 commit comments