Skip to content

Commit efa4494

Browse files
committed
TST: Add more test cases to test_multiindex_loc_order
1 parent 58a80d4 commit efa4494

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pandas/tests/indexes/multi/test_indexing.py

+16
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,22 @@ def test_multiindex_loc_order():
453453
exp_index = pd.MultiIndex.from_arrays([["b", "b", "a", "a"], [1, 2, 1, 2]])
454454
tm.assert_index_equal(res.index, exp_index)
455455

456+
res = df.loc[["a", "b"], :]
457+
exp_index = pd.MultiIndex.from_arrays([["a", "a", "b", "b"], [1, 2, 1, 2]])
458+
tm.assert_index_equal(res.index, exp_index)
459+
460+
res = df.loc[(["a", "b"], [1, 2]), :]
461+
exp_index = pd.MultiIndex.from_arrays([["a", "a", "b", "b"], [1, 2, 1, 2]])
462+
tm.assert_index_equal(res.index, exp_index)
463+
464+
res = df.loc[(["a", "b"], [2, 1]), :]
465+
exp_index = pd.MultiIndex.from_arrays([["a", "a", "b", "b"], [2, 1, 2, 1]])
466+
tm.assert_index_equal(res.index, exp_index)
467+
456468
res = df.loc[(["b", "a"], [2, 1]), :]
457469
exp_index = pd.MultiIndex.from_arrays([["b", "b", "a", "a"], [2, 1, 2, 1]])
458470
tm.assert_index_equal(res.index, exp_index)
471+
472+
res = df.loc[(["b", "a"], [1, 2]), :]
473+
exp_index = pd.MultiIndex.from_arrays([["b", "b", "a", "a"], [1, 2, 1, 2]])
474+
tm.assert_index_equal(res.index, exp_index)

0 commit comments

Comments
 (0)