@@ -1164,23 +1164,24 @@ def _check_how(other, how):
1164
1164
level = 'second' ,
1165
1165
return_indexers = True )
1166
1166
1167
- join_index2 , ridx2 , lidx2 = self .index .join (other , how = how ,
1168
- level = 'second' ,
1169
- return_indexers = True )
1170
-
1171
- self .assert_ (join_index .equals (join_index2 ))
1172
- self .assert_ (np .array_equal (lidx , lidx2 ))
1173
- self .assert_ (np .array_equal (ridx , ridx2 ))
1174
-
1175
- exp_level = self .index .levels [1 ].join (other , how = how )
1167
+ exp_level = other .join (self .index .levels [1 ], how = how )
1176
1168
self .assert_ (join_index .levels [0 ].equals (self .index .levels [0 ]))
1177
1169
self .assert_ (join_index .levels [1 ].equals (exp_level ))
1178
1170
1179
1171
# pare down levels
1180
1172
mask = np .array ([x [1 ] in exp_level for x in self .index ], dtype = bool )
1181
1173
exp_values = self .index .values [mask ]
1182
1174
self .assert_ (np .array_equal (join_index .values , exp_values ))
1183
- self .assert_ (np .array_equal (join_index2 .values , exp_values ))
1175
+
1176
+ if how in ('outer' , 'inner' ):
1177
+ join_index2 , ridx2 , lidx2 = \
1178
+ self .index .join (other , how = how , level = 'second' ,
1179
+ return_indexers = True )
1180
+
1181
+ self .assert_ (join_index .equals (join_index2 ))
1182
+ self .assert_ (np .array_equal (lidx , lidx2 ))
1183
+ self .assert_ (np .array_equal (ridx , ridx2 ))
1184
+ self .assert_ (np .array_equal (join_index2 .values , exp_values ))
1184
1185
1185
1186
def _check_all (other ):
1186
1187
_check_how (other , 'outer' )
0 commit comments