@@ -40,7 +40,9 @@ class EmptyRegressor(RegressorMixin, BaseEstimator):
40
40
pass
41
41
42
42
43
- @pytest .mark .filterwarnings ("ignore:.*no __sklearn_tags__ attribute.*:FutureWarning" )
43
+ @pytest .mark .filterwarnings (
44
+ "ignore:.*no __sklearn_tags__ attribute.*:DeprecationWarning"
45
+ )
44
46
@pytest .mark .parametrize (
45
47
"estimator, value" ,
46
48
[
@@ -169,7 +171,7 @@ def test_get_tags_backward_compatibility():
169
171
predictor_classes = [PredictorNewTags , PredictorOldNewTags , PredictorOldTags ]
170
172
for predictor_cls in predictor_classes :
171
173
if predictor_cls .__name__ .endswith ("OldTags" ):
172
- with pytest .warns (FutureWarning , match = warn_msg ):
174
+ with pytest .warns (DeprecationWarning , match = warn_msg ):
173
175
tags = get_tags (predictor_cls ())
174
176
else :
175
177
tags = get_tags (predictor_cls ())
@@ -194,7 +196,7 @@ class ChildClass(allow_nan_cls, predictor_cls):
194
196
base_cls .__name__ .endswith ("OldTags" )
195
197
for base_cls in (predictor_cls , allow_nan_cls )
196
198
):
197
- with pytest .warns (FutureWarning , match = warn_msg ):
199
+ with pytest .warns (DeprecationWarning , match = warn_msg ):
198
200
tags = get_tags (ChildClass ())
199
201
else :
200
202
tags = get_tags (ChildClass ())
@@ -227,7 +229,7 @@ class ChildClass(allow_nan_cls, array_api_cls, predictor_cls):
227
229
base_cls .__name__ .endswith ("OldTags" )
228
230
for base_cls in (predictor_cls , array_api_cls , allow_nan_cls )
229
231
):
230
- with pytest .warns (FutureWarning , match = warn_msg ):
232
+ with pytest .warns (DeprecationWarning , match = warn_msg ):
231
233
tags = get_tags (ChildClass ())
232
234
else :
233
235
tags = get_tags (ChildClass ())
@@ -238,7 +240,7 @@ class ChildClass(allow_nan_cls, array_api_cls, predictor_cls):
238
240
239
241
240
242
@pytest .mark .filterwarnings (
241
- "ignore:.*Please define the `__sklearn_tags__` method.*:FutureWarning "
243
+ "ignore:.*Please define the `__sklearn_tags__` method.*:DeprecationWarning "
242
244
)
243
245
def test_safe_tags_backward_compatibility ():
244
246
warn_msg = "The `_safe_tags` function is deprecated in 1.6"
@@ -247,7 +249,7 @@ def test_safe_tags_backward_compatibility():
247
249
# only predictor inheriting from BaseEstimator
248
250
predictor_classes = [PredictorNewTags , PredictorOldNewTags , PredictorOldTags ]
249
251
for predictor_cls in predictor_classes :
250
- with pytest .warns (FutureWarning , match = warn_msg ):
252
+ with pytest .warns (DeprecationWarning , match = warn_msg ):
251
253
tags = _safe_tags (predictor_cls ())
252
254
assert tags ["requires_fit" ]
253
255
@@ -266,7 +268,7 @@ def test_safe_tags_backward_compatibility():
266
268
class ChildClass (allow_nan_cls , predictor_cls ):
267
269
pass
268
270
269
- with pytest .warns (FutureWarning , match = warn_msg ):
271
+ with pytest .warns (DeprecationWarning , match = warn_msg ):
270
272
tags = _safe_tags (ChildClass ())
271
273
272
274
assert tags ["allow_nan" ]
@@ -293,7 +295,7 @@ class ChildClass(allow_nan_cls, predictor_cls):
293
295
class ChildClass (allow_nan_cls , array_api_cls , predictor_cls ):
294
296
pass
295
297
296
- with pytest .warns (FutureWarning , match = warn_msg ):
298
+ with pytest .warns (DeprecationWarning , match = warn_msg ):
297
299
tags = _safe_tags (ChildClass ())
298
300
299
301
assert tags ["allow_nan" ]
@@ -302,7 +304,7 @@ class ChildClass(allow_nan_cls, array_api_cls, predictor_cls):
302
304
303
305
304
306
@pytest .mark .filterwarnings (
305
- "ignore:.*Please define the `__sklearn_tags__` method.*:FutureWarning "
307
+ "ignore:.*Please define the `__sklearn_tags__` method.*:DeprecationWarning "
306
308
)
307
309
def test__get_tags_backward_compatibility ():
308
310
warn_msg = "The `_get_tags` method is deprecated in 1.6"
@@ -311,7 +313,7 @@ def test__get_tags_backward_compatibility():
311
313
# only predictor inheriting from BaseEstimator
312
314
predictor_classes = [PredictorNewTags , PredictorOldNewTags , PredictorOldTags ]
313
315
for predictor_cls in predictor_classes :
314
- with pytest .warns (FutureWarning , match = warn_msg ):
316
+ with pytest .warns (DeprecationWarning , match = warn_msg ):
315
317
tags = predictor_cls ()._get_tags ()
316
318
assert tags ["requires_fit" ]
317
319
@@ -330,7 +332,7 @@ def test__get_tags_backward_compatibility():
330
332
class ChildClass (allow_nan_cls , predictor_cls ):
331
333
pass
332
334
333
- with pytest .warns (FutureWarning , match = warn_msg ):
335
+ with pytest .warns (DeprecationWarning , match = warn_msg ):
334
336
tags = ChildClass ()._get_tags ()
335
337
336
338
assert tags ["allow_nan" ]
@@ -357,7 +359,7 @@ class ChildClass(allow_nan_cls, predictor_cls):
357
359
class ChildClass (allow_nan_cls , array_api_cls , predictor_cls ):
358
360
pass
359
361
360
- with pytest .warns (FutureWarning , match = warn_msg ):
362
+ with pytest .warns (DeprecationWarning , match = warn_msg ):
361
363
tags = ChildClass ()._get_tags ()
362
364
363
365
assert tags ["allow_nan" ]
@@ -376,29 +378,35 @@ def test_base_estimator_more_tags():
376
378
`BaseEstimator`.
377
379
"""
378
380
estimator = BaseEstimator ()
379
- with pytest .warns (FutureWarning , match = "The `_more_tags` method is deprecated" ):
381
+ with pytest .warns (
382
+ DeprecationWarning , match = "The `_more_tags` method is deprecated"
383
+ ):
380
384
more_tags = BaseEstimator ._more_tags (estimator )
381
385
382
- with pytest .warns (FutureWarning , match = "The `_get_tags` method is deprecated" ):
386
+ with pytest .warns (DeprecationWarning , match = "The `_get_tags` method is deprecated" ):
383
387
get_tags = BaseEstimator ._get_tags (estimator )
384
388
385
389
assert more_tags == get_tags
386
390
387
391
388
392
def test_safe_tags ():
389
393
estimator = PredictorNewTags ()
390
- with pytest .warns (FutureWarning , match = "The `_safe_tags` function is deprecated" ):
394
+ with pytest .warns (
395
+ DeprecationWarning , match = "The `_safe_tags` function is deprecated"
396
+ ):
391
397
tags = _safe_tags (estimator )
392
398
393
- with pytest .warns (FutureWarning , match = "The `_safe_tags` function is deprecated" ):
399
+ with pytest .warns (
400
+ DeprecationWarning , match = "The `_safe_tags` function is deprecated"
401
+ ):
394
402
tags_requires_fit = _safe_tags (estimator , key = "requires_fit" )
395
403
396
404
assert tags_requires_fit == tags ["requires_fit" ]
397
405
398
406
err_msg = "The key unknown_key is not defined"
399
407
with pytest .raises (ValueError , match = err_msg ):
400
408
with pytest .warns (
401
- FutureWarning , match = "The `_safe_tags` function is deprecated"
409
+ DeprecationWarning , match = "The `_safe_tags` function is deprecated"
402
410
):
403
411
_safe_tags (estimator , key = "unknown_key" )
404
412
0 commit comments