Skip to content

Commit 16ee5ac

Browse files
Robert Juergensqinhanmin2014
authored andcommitted
TST Fixed assert statements, now using assert_array_equal function (scikit-learn#15428)
1 parent 0a80ee9 commit 16ee5ac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sklearn/ensemble/tests/test_voting.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,21 @@ def test_predict_on_toy_problem():
181181

182182
y = np.array([1, 1, 1, 2, 2, 2])
183183

184-
assert all(clf1.fit(X, y).predict(X)) == all([1, 1, 1, 2, 2, 2])
185-
assert all(clf2.fit(X, y).predict(X)) == all([1, 1, 1, 2, 2, 2])
186-
assert all(clf3.fit(X, y).predict(X)) == all([1, 1, 1, 2, 2, 2])
184+
assert_array_equal(clf1.fit(X, y).predict(X), [1, 1, 1, 2, 2, 2])
185+
assert_array_equal(clf2.fit(X, y).predict(X), [1, 1, 1, 2, 2, 2])
186+
assert_array_equal(clf3.fit(X, y).predict(X), [1, 1, 1, 2, 2, 2])
187187

188188
eclf = VotingClassifier(estimators=[
189189
('lr', clf1), ('rf', clf2), ('gnb', clf3)],
190190
voting='hard',
191191
weights=[1, 1, 1])
192-
assert all(eclf.fit(X, y).predict(X)) == all([1, 1, 1, 2, 2, 2])
192+
assert_array_equal(eclf.fit(X, y).predict(X), [1, 1, 1, 2, 2, 2])
193193

194194
eclf = VotingClassifier(estimators=[
195195
('lr', clf1), ('rf', clf2), ('gnb', clf3)],
196196
voting='soft',
197197
weights=[1, 1, 1])
198-
assert all(eclf.fit(X, y).predict(X)) == all([1, 1, 1, 2, 2, 2])
198+
assert_array_equal(eclf.fit(X, y).predict(X), [1, 1, 1, 2, 2, 2])
199199

200200

201201
def test_predict_proba_on_toy_problem():

0 commit comments

Comments
 (0)