Skip to content

Commit a8626b3

Browse files
committed
TST/COSMIT remove nose call boilerplate
1 parent 44f17b0 commit a8626b3

32 files changed

+6
-165
lines changed

sklearn/cluster/tests/test_hierarchical.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ def test_n_components():
496496
for linkage_func in _TREE_BUILDERS.values():
497497
assert_equal(ignore_warnings(linkage_func)(X, connectivity)[1], 5)
498498

499+
499500
def test_agg_n_clusters():
500501
# Test that an error is raised when n_clusters <= 0
501502

@@ -506,7 +507,3 @@ def test_agg_n_clusters():
506507
msg = ("n_clusters should be an integer greater than 0."
507508
" %s was provided." % str(agc.n_clusters))
508509
assert_raise_message(ValueError, msg, agc.fit, X)
509-
510-
if __name__ == '__main__':
511-
import nose
512-
nose.run(argv=['', __file__])

sklearn/decomposition/tests/test_fastica.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,3 @@ def test_inverse_transform():
234234
# reversibility test in non-reduction case
235235
if n_components == X.shape[1]:
236236
assert_array_almost_equal(X, X2)
237-
238-
239-
if __name__ == '__main__':
240-
import nose
241-
nose.run(argv=['', __file__])

sklearn/decomposition/tests/test_kernel_pca.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,3 @@ def test_nested_circles():
207207
# The data is perfectly linearly separable in that space
208208
train_score = Perceptron().fit(X_kpca, y).score(X_kpca, y)
209209
assert_equal(train_score, 1.0)
210-
211-
212-
if __name__ == '__main__':
213-
import nose
214-
nose.run(argv=['', __file__])

sklearn/decomposition/tests/test_nmf.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,3 @@ def test_sparse_transform():
164164
A_tr = model.transform(A)
165165
# This solver seems pretty inconsistent
166166
assert_array_almost_equal(A_fit_tr, A_tr, decimal=2)
167-
168-
169-
if __name__ == '__main__':
170-
import nose
171-
nose.run(argv=['', __file__])

sklearn/decomposition/tests/test_pca.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,3 @@ def test_pca_score3():
328328
ll[k] = pca.score(Xt)
329329

330330
assert_true(ll.argmax() == 1)
331-
332-
333-
if __name__ == '__main__':
334-
import nose
335-
nose.run(argv=['', __file__])

sklearn/ensemble/tests/test_bagging.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,3 @@ def test_oob_score_removed_on_warm_start():
662662
clf.fit(X, y)
663663

664664
assert_raises(AttributeError, getattr, clf, "oob_score_")
665-
666-
667-
if __name__ == "__main__":
668-
import nose
669-
nose.runmodule()

sklearn/ensemble/tests/test_forest.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def test_parallel():
329329
yield check_parallel, name, iris.data, iris.target
330330

331331
for name in FOREST_REGRESSORS:
332-
yield check_parallel, name, boston.data, boston.target
332+
yield check_parallel, name, boston.data, boston.target
333333

334334

335335
def check_pickle(name, X, y):
@@ -352,7 +352,7 @@ def test_pickle():
352352
yield check_pickle, name, iris.data[::2], iris.target[::2]
353353

354354
for name in FOREST_REGRESSORS:
355-
yield check_pickle, name, boston.data[::2], boston.target[::2]
355+
yield check_pickle, name, boston.data[::2], boston.target[::2]
356356

357357

358358
def check_multioutput(name):
@@ -782,7 +782,7 @@ def check_class_weights(name):
782782

783783
# Check that sample_weight and class_weight are multiplicative
784784
clf1 = ForestClassifier(random_state=0)
785-
clf1.fit(iris.data, iris.target, sample_weight**2)
785+
clf1.fit(iris.data, iris.target, sample_weight ** 2)
786786
clf2 = ForestClassifier(class_weight=class_weight, random_state=0)
787787
clf2.fit(iris.data, iris.target, sample_weight)
788788
assert_almost_equal(clf1.feature_importances_, clf2.feature_importances_)
@@ -973,8 +973,3 @@ def test_warm_start_oob():
973973
yield check_warm_start_oob, name
974974
for name in FOREST_REGRESSORS:
975975
yield check_warm_start_oob, name
976-
977-
978-
if __name__ == "__main__":
979-
import nose
980-
nose.runmodule()

sklearn/ensemble/tests/test_gradient_boosting.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,8 +1012,3 @@ def test_non_uniform_weights_toy_edge_case_clf():
10121012
gb = GradientBoostingClassifier(n_estimators=5)
10131013
gb.fit(X, y, sample_weight=sample_weight)
10141014
assert_array_equal(gb.predict([[1, 0]]), [1])
1015-
1016-
1017-
if __name__ == "__main__":
1018-
import nose
1019-
nose.runmodule()

sklearn/ensemble/tests/test_weight_boosting.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,3 @@ def fit(self, X, y, sample_weight=None):
419419

420420
assert all([(t == csc_matrix or t == csr_matrix)
421421
for t in types])
422-
423-
424-
if __name__ == "__main__":
425-
import nose
426-
nose.runmodule()

sklearn/feature_extraction/tests/test_image.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,3 @@ def test_width_patch():
288288
x = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
289289
assert_raises(ValueError, extract_patches_2d, x, (4, 1))
290290
assert_raises(ValueError, extract_patches_2d, x, (1, 4))
291-
292-
293-
if __name__ == '__main__':
294-
import nose
295-
nose.runmodule()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy