Skip to content

Commit 492dd0e

Browse files
jorisvandenbosscheWillAyd
authored andcommitted
TST (string dtype): remove usage of arrow_string_storage fixture (#59368)
* TST (string dtype): remove usage of arrow_string_storage fixture * fixup
1 parent 30ee266 commit 492dd0e

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

pandas/tests/arrays/string_/test_string.py

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

167167

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

465465
@pytest.mark.parametrize("method", ["min", "max"])
466466
@pytest.mark.parametrize("box", [pd.Series, pd.array])
467-
def test_min_max_numpy(method, box, dtype, request, arrow_string_storage):
468-
if dtype.storage in arrow_string_storage and box is pd.array:
467+
def test_min_max_numpy(method, box, dtype, request):
468+
if dtype.storage == "pyarrow" and box is pd.array:
469469
if box is pd.array:
470470
reason = "'<=' not supported between instances of 'str' and 'NoneType'"
471471
else:
@@ -479,7 +479,7 @@ def test_min_max_numpy(method, box, dtype, request, arrow_string_storage):
479479
assert result == expected
480480

481481

482-
def test_fillna_args(dtype, arrow_string_storage):
482+
def test_fillna_args(dtype):
483483
# GH 37987
484484

485485
arr = pd.array(["a", pd.NA], dtype=dtype)
@@ -492,7 +492,7 @@ def test_fillna_args(dtype, arrow_string_storage):
492492
expected = pd.array(["a", "b"], dtype=dtype)
493493
tm.assert_extension_array_equal(res, expected)
494494

495-
if dtype.storage in arrow_string_storage:
495+
if dtype.storage == "pyarrow":
496496
msg = "Invalid value '1' for dtype string"
497497
else:
498498
msg = "Cannot set non-string value '1' into a StringArray."
@@ -643,10 +643,10 @@ def test_value_counts_sort_false(dtype):
643643
tm.assert_series_equal(result, expected)
644644

645645

646-
def test_memory_usage(dtype, arrow_string_storage):
646+
def test_memory_usage(dtype):
647647
# GH 33963
648648

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

652652
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
@@ -115,22 +115,22 @@ def test_is_not_string_type(self, dtype):
115115
# because StringDtype is a string type
116116
assert is_string_dtype(dtype)
117117

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

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

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

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

0 commit comments

Comments
 (0)