Skip to content

Commit df81cc0

Browse files
committed
Fix tests
1 parent 3b5974d commit df81cc0

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

pandas/tests/frame/methods/test_replace.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,19 @@ def test_regex_replace_string_types(
447447
frame_or_series,
448448
any_string_dtype,
449449
using_infer_string,
450+
request,
450451
):
451452
# GH-41333, GH-35977
452453
dtype = any_string_dtype
453454
obj = frame_or_series(data, dtype=dtype)
454455
if using_infer_string and any_string_dtype == "object":
456+
if len(to_replace) > 1 and isinstance(obj, DataFrame):
457+
request.node.add_marker(
458+
pytest.mark.xfail(
459+
reason="object input array that gets downcasted raises on "
460+
"second pass"
461+
)
462+
)
455463
with tm.assert_produces_warning(FutureWarning, match="Downcasting"):
456464
result = obj.replace(to_replace, regex=True)
457465
dtype = "string[pyarrow_numpy]"

pandas/tests/frame/methods/test_to_csv.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,9 @@ def test_to_csv_interval_index(self, using_infer_string):
622622

623623
# can't roundtrip intervalindex via read_csv so check string repr (GH 23595)
624624
expected = df.copy()
625-
if not using_infer_string:
625+
if using_infer_string:
626+
expected.index = expected.index.astype("string[pyarrow_numpy]")
627+
else:
626628
expected.index = expected.index.astype(str)
627629

628630
tm.assert_frame_equal(result, expected)

pandas/tests/frame/methods/test_value_counts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_data_frame_value_counts_dropna_false(nulls_fixture):
147147
index=pd.MultiIndex(
148148
levels=[
149149
pd.Index(["Anne", "Beth", "John"]),
150-
pd.Index(["Louise", "Smith", nulls_fixture]),
150+
pd.Index(["Louise", "Smith", np.nan]), # GH#48476
151151
],
152152
codes=[[0, 1, 2, 2], [2, 0, 1, 2]],
153153
names=["first_name", "middle_name"],

0 commit comments

Comments
 (0)