Skip to content

TST Add StringDType cases to target detection and numeric validation tests - #35094

Closed
lcrmorin wants to merge 3 commits into
scikit-learn:mainfrom
lcrmorin:stringdtype-existing-validation-tests-34946
Closed

lcrmorin wants to merge 3 commits into
scikit-learn:mainfrom
lcrmorin:stringdtype-existing-validation-tests-34946

Conversation

@lcrmorin

@lcrmorin lcrmorin commented Oct 7, 2026 •

Copy link
Copy Markdown

Reference Issues/PRs

Related to #34946. Tests-only follow-up to the feedback on #35082.

What does this implement/fix? Explain your changes.

This starts with two small extensions to existing tests, in separate commits:

  • test_type_of_target: add StringDType binary, multiclass and multioutput targets. On older NumPy, dtype detection fails before downstream code can be exercised.
  • test_check_array_numeric_error: add numeric-looking and non-numeric StringDType strings. Numeric-only validation should reject both with the existing string-input error.

The goal is to allow Stringdtype to reach relevant estimators. This documents the failures without fixing them, with the goal to make estimator failure more explicit.

I reused existing tests functions with new example to limit line of code changes. The diff is +38/−2 across two files.

Validation

Local results for the two extended tests (including their existing cases):

NumPy Passed Expected failures
2.2.4 6 5
2.5.3 9 2
1.26.4 6 0

The five additional StringDType cases are not collected on NumPy 1.x. Expected failures are not fixed bugs; --runxfail exposes them as ordinary failures.

AI usage disclosure

This pull request includes code written with the assistance of AI.
The code, texts were reviewed by a human.

This pull request includes code written with the assistance of AI. The code has not yet been reviewed by a human.
This pull request includes code written with the assistance of AI. The code has not yet been reviewed by a human.
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Thank you for opening your first pull request to scikit-learn! 🎉

To help get your contribution reviewed, please make sure that:

  • You have filled out the pull request template.

  • The pull request addresses an existing issue that is ready for contribution (e.g. not tagged as 'Needs Triage', 'Needs Decision', ...). If you are proposing a new feature, please open an issue to discuss it first.

  • There are no other open pull requests already targeting the same issue.

  • You have followed the pull request checklist. In particular, linting and tests should pass.

@lcrmorin
lcrmorin marked this pull request as ready for review October 7, 2026 13:47
@lcrmorin
lcrmorin marked this pull request as draft November 5, 2026 10:30
@lcrmorin lcrmorin closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant