Skip to content

Commit 7a42a8c

Browse files
[ArrowStringArray] fix test_repeat_with_null (#41001)
1 parent 12c6de1 commit 7a42a8c

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

pandas/core/strings/object_array.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ def scalar_rep(x):
198198
return self._str_map(scalar_rep, dtype=str)
199199
else:
200200
from pandas.core.arrays.string_ import StringArray
201+
from pandas.core.arrays.string_arrow import ArrowStringArray
201202

202203
def rep(x, r):
203204
if x is libmissing.NA:
@@ -209,9 +210,9 @@ def rep(x, r):
209210

210211
repeats = np.asarray(repeats, dtype=object)
211212
result = libops.vec_binop(np.asarray(self), repeats, rep)
212-
if isinstance(self, StringArray):
213+
if isinstance(self, (StringArray, ArrowStringArray)):
213214
# Not going through map, so we have to do this here.
214-
result = StringArray._from_sequence(result)
215+
result = type(self)._from_sequence(result)
215216
return result
216217

217218
def _str_match(

pandas/tests/strings/test_strings.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,8 @@ def test_repeat():
136136
tm.assert_series_equal(rs, xp)
137137

138138

139-
def test_repeat_with_null(nullable_string_dtype, request):
139+
def test_repeat_with_null(nullable_string_dtype):
140140
# GH: 31632
141-
142-
if nullable_string_dtype == "arrow_string":
143-
reason = 'Attribute "dtype" are different'
144-
mark = pytest.mark.xfail(reason=reason)
145-
request.node.add_marker(mark)
146-
147141
ser = Series(["a", None], dtype=nullable_string_dtype)
148142
result = ser.str.repeat([3, 4])
149143
expected = Series(["aaa", None], dtype=nullable_string_dtype)

0 commit comments

Comments
 (0)