Skip to content

Commit 650d41c

Browse files
committed
TST: Add more test cases to test_multiindex_loc_order
1 parent 9aa4365 commit 650d41c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pandas/tests/indexes/multi/test_indexing.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,22 @@ def test_multiindex_loc_order():
542542
exp_index = pd.MultiIndex.from_arrays([["b", "b", "a", "a"], [1, 2, 1, 2]])
543543
tm.assert_index_equal(res.index, exp_index)
544544

545+
res = df.loc[["a", "b"], :]
546+
exp_index = pd.MultiIndex.from_arrays([["a", "a", "b", "b"], [1, 2, 1, 2]])
547+
tm.assert_index_equal(res.index, exp_index)
548+
549+
res = df.loc[(["a", "b"], [1, 2]), :]
550+
exp_index = pd.MultiIndex.from_arrays([["a", "a", "b", "b"], [1, 2, 1, 2]])
551+
tm.assert_index_equal(res.index, exp_index)
552+
553+
res = df.loc[(["a", "b"], [2, 1]), :]
554+
exp_index = pd.MultiIndex.from_arrays([["a", "a", "b", "b"], [2, 1, 2, 1]])
555+
tm.assert_index_equal(res.index, exp_index)
556+
545557
res = df.loc[(["b", "a"], [2, 1]), :]
546558
exp_index = pd.MultiIndex.from_arrays([["b", "b", "a", "a"], [2, 1, 2, 1]])
547559
tm.assert_index_equal(res.index, exp_index)
560+
561+
res = df.loc[(["b", "a"], [1, 2]), :]
562+
exp_index = pd.MultiIndex.from_arrays([["b", "b", "a", "a"], [1, 2, 1, 2]])
563+
tm.assert_index_equal(res.index, exp_index)

0 commit comments

Comments
 (0)