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): remove usage of arrow_string_storage fixture #59368

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
8 changes: 0 additions & 8 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2039,14 +2039,6 @@ def warsaw(request) -> str:
return request.param


@pytest.fixture
def arrow_string_storage():
"""
Fixture that lists possible PyArrow values for StringDtype storage field.
"""
return ("pyarrow", "pyarrow_numpy")


@pytest.fixture
def temp_file(tmp_path):
"""
Expand Down
16 changes: 8 additions & 8 deletions pandas/tests/arrays/string_/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ def test_add(dtype):
tm.assert_series_equal(result, expected)


def test_add_2d(dtype, request, arrow_string_storage):
if dtype.storage in arrow_string_storage:
def test_add_2d(dtype, request):
if dtype.storage == "pyarrow":
reason = "Failed: DID NOT RAISE <class 'ValueError'>"
mark = pytest.mark.xfail(raises=None, reason=reason)
request.applymarker(mark)
Expand Down Expand Up @@ -462,8 +462,8 @@ def test_min_max(method, skipna, dtype):

@pytest.mark.parametrize("method", ["min", "max"])
@pytest.mark.parametrize("box", [pd.Series, pd.array])
def test_min_max_numpy(method, box, dtype, request, arrow_string_storage):
if dtype.storage in arrow_string_storage and box is pd.array:
def test_min_max_numpy(method, box, dtype, request):
if dtype.storage == "pyarrow" and box is pd.array:
if box is pd.array:
reason = "'<=' not supported between instances of 'str' and 'NoneType'"
else:
Expand All @@ -477,7 +477,7 @@ def test_min_max_numpy(method, box, dtype, request, arrow_string_storage):
assert result == expected


def test_fillna_args(dtype, arrow_string_storage):
def test_fillna_args(dtype):
# GH 37987

arr = pd.array(["a", pd.NA], dtype=dtype)
Expand All @@ -490,7 +490,7 @@ def test_fillna_args(dtype, arrow_string_storage):
expected = pd.array(["a", "b"], dtype=dtype)
tm.assert_extension_array_equal(res, expected)

if dtype.storage in arrow_string_storage:
if dtype.storage == "pyarrow":
msg = "Invalid value '1' for dtype string"
else:
msg = "Cannot set non-string value '1' into a StringArray."
Expand Down Expand Up @@ -616,10 +616,10 @@ def test_value_counts_sort_false(dtype):
tm.assert_series_equal(result, expected)


def test_memory_usage(dtype, arrow_string_storage):
def test_memory_usage(dtype):
# GH 33963

if dtype.storage in arrow_string_storage:
if dtype.storage == "pyarrow":
pytest.skip(f"not applicable for {dtype.storage}")

series = pd.Series(["a", "b", "c"], dtype=dtype)
Expand Down
12 changes: 6 additions & 6 deletions pandas/tests/arrays/string_/test_string_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ def test_config_bad_storage_raises():


@pytest.mark.parametrize("chunked", [True, False])
@pytest.mark.parametrize("array", ["numpy", "pyarrow"])
def test_constructor_not_string_type_raises(array, chunked, arrow_string_storage):
@pytest.mark.parametrize("array_lib", ["numpy", "pyarrow"])
def test_constructor_not_string_type_raises(array_lib, chunked):
pa = pytest.importorskip("pyarrow")

array = pa if array in arrow_string_storage else np
array_lib = pa if array_lib == "pyarrow" else np

arr = array.array([1, 2, 3])
arr = array_lib.array([1, 2, 3])
if chunked:
if array is np:
if array_lib is np:
pytest.skip("chunked not applicable to numpy array")
arr = pa.chunked_array(arr)
if array is np:
if array_lib is np:
msg = "Unsupported type '<class 'numpy.ndarray'>' for ArrowExtensionArray"
else:
msg = re.escape(
Expand Down
12 changes: 6 additions & 6 deletions pandas/tests/extension/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,22 @@ def test_is_not_string_type(self, dtype):
# because StringDtype is a string type
assert is_string_dtype(dtype)

def test_view(self, data, request, arrow_string_storage):
if data.dtype.storage in arrow_string_storage:
def test_view(self, data):
if data.dtype.storage == "pyarrow":
pytest.skip(reason="2D support not implemented for ArrowStringArray")
super().test_view(data)

def test_from_dtype(self, data):
# base test uses string representation of dtype
pass

def test_transpose(self, data, request, arrow_string_storage):
if data.dtype.storage in arrow_string_storage:
def test_transpose(self, data):
if data.dtype.storage == "pyarrow":
pytest.skip(reason="2D support not implemented for ArrowStringArray")
super().test_transpose(data)

def test_setitem_preserves_views(self, data, request, arrow_string_storage):
if data.dtype.storage in arrow_string_storage:
def test_setitem_preserves_views(self, data):
if data.dtype.storage == "pyarrow":
pytest.skip(reason="2D support not implemented for ArrowStringArray")
super().test_setitem_preserves_views(data)

Expand Down
Loading