TST fix estimator checks when set_output is called on the instance#29869
TST fix estimator checks when set_output is called on the instance#29869thomasjpfan merged 8 commits intoscikit-learn:mainfrom
Conversation
| @parametrize_with_checks( | ||
| [ | ||
| StandardScaler().set_output(transform="pandas"), | ||
| StandardScaler().set_output(transform="polars"), |
There was a problem hiding this comment.
You might need to have some skipif because polars or pandas are optional dependencies.
There was a problem hiding this comment.
these lines don't fail if pandas/polars are not installed, and check_estimator also dosn't fail when they're not installed.
There was a problem hiding this comment.
Scratch that, it fails. I'll fix it.
Charlie-XIAO
left a comment
There was a problem hiding this comment.
This LGTM as long as the comment above is resolved :)
|
|
||
|
|
||
| # Test that set_output doesn't make the tests to fail. | ||
| @parametrize_with_checks( |
There was a problem hiding this comment.
We can not use parametrize_with_checks here because it depends on pytest. The simple fix is to move it to sklearn/tests/test_common.py.
There was a problem hiding this comment.
I kinda prefer to have test_common.py to have as least tests as possible, to reduce the difference between what we force on third party estimators and what we expect from our own.
So I refactored the test here.
Fixes #26842
This fixes the issues with transformers where
set_outputis called on them.cc @glemaitre @Charlie-XIAO