Skip to content

Commit 9479c6b

Browse files
additional test fixes (for tests that changed or no longer exist on main
1 parent cdb8bcd commit 9479c6b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pandas/tests/indexing/test_indexing.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ def test_loc_setitem_fullindex_views(self):
687687
df.loc[df.index] = df.loc[df.index]
688688
tm.assert_frame_equal(df, df2)
689689

690-
def test_rhs_alignment(self):
690+
def test_rhs_alignment(self, using_infer_string):
691691
# GH8258, tests that both rows & columns are aligned to what is
692692
# assigned to. covers both uniform data-type & multi-type cases
693693
def run_tests(df, rhs, right_loc, right_iloc):
@@ -731,8 +731,17 @@ def run_tests(df, rhs, right_loc, right_iloc):
731731
frame["jolie"] = frame["jolie"].map(lambda x: f"@{x}")
732732
right_iloc["joe"] = [1.0, "@-28", "@-20", "@-12", 17.0]
733733
right_iloc["jolie"] = ["@2", -26.0, -18.0, -10.0, "@18"]
734-
with tm.assert_produces_warning(FutureWarning, match="incompatible dtype"):
735-
run_tests(df, rhs, right_loc, right_iloc)
734+
if using_infer_string:
735+
with pytest.raises(
736+
TypeError, match="Must provide strings|Scalar must be NA or str"
737+
):
738+
with tm.assert_produces_warning(
739+
FutureWarning, match="incompatible dtype"
740+
):
741+
run_tests(df, rhs, right_loc, right_iloc)
742+
else:
743+
with tm.assert_produces_warning(FutureWarning, match="incompatible dtype"):
744+
run_tests(df, rhs, right_loc, right_iloc)
736745

737746
@pytest.mark.parametrize(
738747
"idx", [_mklbl("A", 20), np.arange(20) + 100, np.linspace(100, 150, 20)]

0 commit comments

Comments
 (0)