Skip to content

Commit c89da87

Browse files
committed
Fix tests
1 parent a9efc05 commit c89da87

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pandas/core/construction.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,9 @@ def sanitize_array(
566566
from pandas.core.arrays.string_ import StringDtype
567567

568568
dtype = StringDtype("pyarrow_numpy")
569-
data = dtype.construct_array_type()._from_sequence_of_strings([data])
569+
data = dtype.construct_array_type()._from_sequence_of_strings(
570+
[data] * len(index)
571+
)
570572
else:
571573
data = construct_1d_arraylike_from_scalar(data, len(index), dtype)
572574

pandas/tests/frame/indexing/test_set_value.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_set_value(self, float_frame):
1616
float_frame._set_value(idx, col, 1)
1717
assert float_frame[col][idx] == 1
1818

19-
def test_set_value_resize(self, float_frame):
19+
def test_set_value_resize(self, float_frame, using_infer_string):
2020
res = float_frame._set_value("foobar", "B", 0)
2121
assert res is None
2222
assert float_frame.index[-1] == "foobar"
@@ -27,8 +27,10 @@ def test_set_value_resize(self, float_frame):
2727

2828
res = float_frame.copy()
2929
res._set_value("foobar", "baz", "sam")
30-
assert res["baz"].dtype == np.object_
31-
30+
if using_infer_string:
31+
assert res["baz"].dtype == "string"
32+
else:
33+
assert res["baz"].dtype == np.object_
3234
res = float_frame.copy()
3335
with tm.assert_produces_warning(
3436
FutureWarning, match="Setting an item of incompatible dtype"

0 commit comments

Comments
 (0)