Skip to content

Commit 8f947ad

Browse files
committed
added xfail test for xs with pd.IndexSlice argument
1 parent 3adaf29 commit 8f947ad

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/test_multilevel.py

+10
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,16 @@ def test_level_with_tuples(self):
12581258
tm.assert_frame_equal(result, expected)
12591259
tm.assert_frame_equal(result2, expected)
12601260

1261+
# GH 35301
1262+
msg = (
1263+
"Expected label or tuple of labels, got "
1264+
r"\(\('foo', 'qux', 0\), slice\(None, None, None\)\)"
1265+
)
1266+
with pytest.raises(TypeError, match=msg):
1267+
frame.xs(pd.IndexSlice[("foo", "qux", 0), :])
1268+
with pytest.raises(TypeError, match=msg):
1269+
series.xs(pd.IndexSlice[("foo", "qux", 0), :])
1270+
12611271
index = MultiIndex(
12621272
levels=[[("foo", "bar"), ("foo", "baz"), ("foo", "qux")], [0, 1]],
12631273
codes=[[0, 0, 1, 1, 2, 2], [0, 1, 0, 1, 0, 1]],

0 commit comments

Comments
 (0)