Skip to content

CLN: remove unnecessary usage of option_context with future.infer_string in tests#65048

Draft
jorisvandenbossche wants to merge 2 commits intopandas-dev:mainfrom
jorisvandenbossche:cln-tests-infer-string-option
Draft

CLN: remove unnecessary usage of option_context with future.infer_string in tests#65048
jorisvandenbossche wants to merge 2 commits intopandas-dev:mainfrom
jorisvandenbossche:cln-tests-infer-string-option

Conversation

@jorisvandenbossche
Copy link
Copy Markdown
Member

Noticed this in one of the tests: this is mostly a leftover from the time when the option was not enabled by default, and we wanted to test some of those things consistently (not only in the one build that enabled it).
Now that is no longer needed (and we also still have one build that disables it). The remaining use cases of pd.option_context("future.infer_string", ..) are in the (dtype) constructor tests that explicitly test the resulting dtype, and where it would be more verbose to update those tests to depend on using_infer_string fixture to have it pass everywhere.

@jorisvandenbossche jorisvandenbossche added this to the 3.1 milestone Apr 3, 2026
@jorisvandenbossche jorisvandenbossche added Testing pandas testing functions or related to the test suite Clean labels Apr 3, 2026
Comment on lines -171 to -176

df = feather.read_feather(
handles.handle, columns=columns, use_threads=bool(use_threads)
)
# Convert any StringDtype columns to object dtype (pyarrow always
# uses string dtype even when the infer_string option is False)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also handled in the arrow_table_to_pandas call below (with the only difference that there we do an additional fillna(None) to keep the behaviour consistent that pyarrow conversion to pandas with object dtype uses None for missing values)

@jbrockmendel
Copy link
Copy Markdown
Member

Nice cleanup! LGTM pending green

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Clean Testing pandas testing functions or related to the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants