Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST (string dtype): replace string_storage fixture with explicit storage/na_value keyword arguments for dtype creation #59375

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,24 @@ def string_storage(request):
return request.param


@pytest.fixture(
params=[
("python", pd.NA),
pytest.param(("pyarrow", pd.NA), marks=td.skip_if_no("pyarrow")),
pytest.param(("pyarrow", np.nan), marks=td.skip_if_no("pyarrow")),
]
)
def string_dtype_arguments(request):
"""
Parametrized fixture for StringDtype storage and na_value.

* 'python' + pd.NA
* 'pyarrow' + pd.NA
* 'pyarrow' + np.nan
"""
return request.param


@pytest.fixture(
params=[
"numpy_nullable",
Expand Down
7 changes: 4 additions & 3 deletions pandas/tests/arrays/string_/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@


@pytest.fixture
def dtype(string_storage):
"""Fixture giving StringDtype from parametrized 'string_storage'"""
return pd.StringDtype(storage=string_storage)
def dtype(string_dtype_arguments):
"""Fixture giving StringDtype from parametrized storage and na_value arguments"""
storage, na_value = string_dtype_arguments
return pd.StringDtype(storage=storage, na_value=na_value)


@pytest.fixture
Expand Down
5 changes: 3 additions & 2 deletions pandas/tests/extension/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def chunked(request):


@pytest.fixture
def dtype(string_storage):
return StringDtype(storage=string_storage)
def dtype(string_dtype_arguments):
storage, na_value = string_dtype_arguments
return StringDtype(storage=storage, na_value=na_value)


@pytest.fixture
Expand Down
Loading