Skip to content

Commit 6d53d06

Browse files
deeplookrth
authored andcommitted
TST Remove test functions defined twice (scikit-learn#15220)
1 parent 86aea99 commit 6d53d06

File tree

1 file changed

+0
-41
lines changed

1 file changed

+0
-41
lines changed

sklearn/preprocessing/tests/test_encoders.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -382,47 +382,6 @@ def test_one_hot_encoder_pandas():
382382
assert_allclose(Xtr, [[1, 0, 1, 0], [0, 1, 0, 1]])
383383

384384

385-
def test_one_hot_encoder_feature_names():
386-
enc = OneHotEncoder()
387-
X = [['Male', 1, 'girl', 2, 3],
388-
['Female', 41, 'girl', 1, 10],
389-
['Male', 51, 'boy', 12, 3],
390-
['Male', 91, 'girl', 21, 30]]
391-
392-
enc.fit(X)
393-
feature_names = enc.get_feature_names()
394-
assert isinstance(feature_names, np.ndarray)
395-
396-
assert_array_equal(['x0_Female', 'x0_Male',
397-
'x1_1', 'x1_41', 'x1_51', 'x1_91',
398-
'x2_boy', 'x2_girl',
399-
'x3_1', 'x3_2', 'x3_12', 'x3_21',
400-
'x4_3',
401-
'x4_10', 'x4_30'], feature_names)
402-
403-
feature_names2 = enc.get_feature_names(['one', 'two',
404-
'three', 'four', 'five'])
405-
406-
assert_array_equal(['one_Female', 'one_Male',
407-
'two_1', 'two_41', 'two_51', 'two_91',
408-
'three_boy', 'three_girl',
409-
'four_1', 'four_2', 'four_12', 'four_21',
410-
'five_3', 'five_10', 'five_30'], feature_names2)
411-
412-
with pytest.raises(ValueError, match="input_features should have length"):
413-
enc.get_feature_names(['one', 'two'])
414-
415-
416-
def test_one_hot_encoder_feature_names_unicode():
417-
enc = OneHotEncoder()
418-
X = np.array([['c❤t1', 'dat2']], dtype=object).T
419-
enc.fit(X)
420-
feature_names = enc.get_feature_names()
421-
assert_array_equal(['x0_c❤t1', 'x0_dat2'], feature_names)
422-
feature_names = enc.get_feature_names(input_features=['n👍me'])
423-
assert_array_equal(['n👍me_c❤t1', 'n👍me_dat2'], feature_names)
424-
425-
426385
@pytest.mark.parametrize("drop, expected_names",
427386
[('first', ['x0_c', 'x2_b']),
428387
(['c', 2, 'b'], ['x0_b', 'x2_a'])],

0 commit comments

Comments
 (0)