@@ -426,10 +426,8 @@ def test_set_estimator_drop():
426
426
voting = "hard" ,
427
427
weights = [1 , 1 , 0.5 ],
428
428
)
429
- with pytest .warns (None ) as record :
430
- eclf2 .set_params (rf = "drop" ).fit (X , y )
429
+ eclf2 .set_params (rf = "drop" ).fit (X , y )
431
430
432
- assert not [w .message for w in record ]
433
431
assert_array_equal (eclf1 .predict (X ), eclf2 .predict (X )
8000
)
434
432
435
433
assert dict (eclf2 .estimators )["rf" ] == "drop"
@@ -440,17 +438,13 @@ def test_set_estimator_drop():
440
438
assert eclf2 .get_params ()["rf" ] == "drop"
441
439
442
440
eclf1 .set_params (voting = "soft" ).fit (X , y )
443
- with pytest .warns (None ) as record :
444
- eclf2 .set_params (voting = "soft" ).fit (X , y )
441
+ eclf2 .set_params (voting = "soft" ).fit (X , y )
445
442
446
- assert not [w .message for w in record ]
447
443
assert_array_equal (eclf1 .predict (X ), eclf2 .predict (X ))
448
444
assert_array_almost_equal (eclf1 .predict_proba (X ), eclf2 .predict_proba (X ))
449
445
msg = "All estimators are dropped. At least one is required"
450
- with pytest .warns (None ) as record :
451
- with pytest .raises (ValueError , match = msg ):
452
- eclf2 .set_params (lr = "drop" , rf = "drop" , nb = "drop" ).fit (X , y )
453
- assert not [w .message for w in record ]
446
+ with pytest .raises (ValueError , match = msg ):
447
+ eclf2 .set_params (lr = "drop" , rf = "drop" , nb = "drop" ).fit (X , y )
454
448
455
449
# Test soft voting transform
456
450
X1 = np .array ([[1 ], [2 ]])
@@ -468,9 +462,7 @@ def test_set_estimator_drop():
468
462
weights = [1 , 0.5 ],
469
463
flatten_transform = False ,
470
464
)
471
- with pytest .warns (None ) as record :
472
- eclf2 .set_params (rf = "drop" ).fit (X1 , y1 )
473
- assert not [w .message for w in record ]
465
+ eclf2 .set_params (rf = "drop" ).fit (X1 , y1 )
474
466
assert_array_almost_equal (
475
467
eclf1 .transform (X1 ),
476
468
np .array ([[[0.7 , 0.3 ], [0.3 , 0.7 ]], [[1.0 , 0.0 ], [0.0 , 1.0 ]]]),
@@ -560,9 +552,7 @@ def test_none_estimator_with_weights(X, y, voter):
560
552
voter = clone (voter )
561
553
voter .fit (X , y , sample_weight = np .ones (y .shape ))
562
554
voter .set_params (lr = "drop" )
563
- with pytest .warns (None ) as record :
564
- voter .fit (X , y , sample_weight = np .ones (y .shape ))
565
- assert not [w .message for w in record ]
555
+ voter .fit (X , y , sample_weight = np .ones (y .shape ))
566
556
y_pred = voter .predict (X )
567
557
assert y_pred .shape == y .shape
568
558
0 commit comments