Skip to content

Commit

Permalink
TST (string dtype): remove usage of arrow_string_storage fixture (pan…
Browse files Browse the repository at this point in the history
…das-dev#59368)

* TST (string dtype): remove usage of arrow_string_storage fixture

* fixup
  • Loading branch information
jorisvandenbossche authored and WillAyd committed Aug 15, 2024
1 parent c3551ae commit 34b1a9f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
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 @@ -165,8 +165,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 @@ -464,8 +464,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 @@ -479,7 +479,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 @@ -492,7 +492,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 @@ -643,10 +643,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 @@ -115,22 +115,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

0 comments on commit 34b1a9f

Please sign in to comment.