Skip to content

Commit 80749af

Browse files
authored
TST: Add test for KeyError with MultiIndex (#37719)
1 parent 5c4f737 commit 80749af

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/indexing/multiindex/test_loc.py

+9
Original file line numberDiff line numberDiff line change
@@ -614,3 +614,12 @@ def test_loc_with_nan():
614614
result = df.loc["a"]
615615
expected = DataFrame({"col": [1]}, index=Index([1], name="ind2"))
616616
tm.assert_frame_equal(result, expected)
617+
618+
619+
def test_getitem_non_found_tuple():
620+
# GH: 25236
621+
df = DataFrame([[1, 2, 3, 4]], columns=["a", "b", "c", "d"]).set_index(
622+
["a", "b", "c"]
623+
)
624+
with pytest.raises(KeyError, match=r"\(2\.0, 2\.0, 3\.0\)"):
625+
df.loc[(2.0, 2.0, 3.0)]

0 commit comments

Comments
 (0)