Skip to content

Commit 4b4c86e

Browse files
TST (string dtype): remove usage of arrow_string_storage fixture (#59368)
* TST (string dtype): remove usage of arrow_string_storage fixture * fixup
1 parent 9c08431 commit 4b4c86e

File tree

4 files changed

+20
-28
lines changed

4 files changed

+20
-28
lines changed

pandas/conftest.py

-8
Original file line numberDiff line numberDiff line change
@@ -2039,14 +2039,6 @@ def warsaw(request) -> str:
20392039
return request.param
20402040

20412041

2042-
@pytest.fixture
2043-
def arrow_string_storage():
2044-
"""
2045-
Fixture that lists possible PyArrow values for StringDtype storage field.
2046-
"""
2047-
return ("pyarrow", "pyarrow_numpy")
2048-
2049-
20502042
@pytest.fixture
20512043
def temp_file(tmp_path):
20522044
"""

pandas/tests/arrays/string_/test_string.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ def test_add(dtype):
166166
tm.assert_series_equal(result, expected)
167167

168168

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

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

479479

480-
def test_fillna_args(dtype, arrow_string_storage):
480+
def test_fillna_args(dtype):
481481
# GH 37987
482482

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

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

618618

619-
def test_memory_usage(dtype, arrow_string_storage):
619+
def test_memory_usage(dtype):
620620
# GH 33963
621621

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

625625
series = pd.Series(["a", "b", "c"], dtype=dtype)

pandas/tests/arrays/string_/test_string_arrow.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ def test_config_bad_storage_raises():
4848

4949

5050
@pytest.mark.parametrize("chunked", [True, False])
51-
@pytest.mark.parametrize("array", ["numpy", "pyarrow"])
52-
def test_constructor_not_string_type_raises(array, chunked, arrow_string_storage):
51+
@pytest.mark.parametrize("array_lib", ["numpy", "pyarrow"])
52+
def test_constructor_not_string_type_raises(array_lib, chunked):
5353
pa = pytest.importorskip("pyarrow")
5454

55-
array = pa if array in arrow_string_storage else np
55+
array_lib = pa if array_lib == "pyarrow" else np
5656

57-
arr = array.array([1, 2, 3])
57+
arr = array_lib.array([1, 2, 3])
5858
if chunked:
59-
if array is np:
59+
if array_lib is np:
6060
pytest.skip("chunked not applicable to numpy array")
6161
arr = pa.chunked_array(arr)
62-
if array is np:
62+
if array_lib is np:
6363
msg = "Unsupported type '<class 'numpy.ndarray'>' for ArrowExtensionArray"
6464
else:
6565
msg = re.escape(

pandas/tests/extension/test_string.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -116,22 +116,22 @@ def test_is_not_string_type(self, dtype):
116116
# because StringDtype is a string type
117117
assert is_string_dtype(dtype)
118118

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

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

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

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

0 commit comments

Comments
 (0)