@@ -178,7 +178,7 @@ def test_intersection_base(self, index):
178
178
return
179
179
180
180
# GH#10149
181
- cases = [klass ( second .values ) for klass in [ np . array , Series , list ] ]
181
+ cases = [second .to_numpy (), second . to_series (), second . to_list () ]
182
182
for case in cases :
183
183
result = first .intersection (case )
184
184
assert tm .equalContents (result , second )
@@ -201,15 +201,10 @@ def test_union_base(self, index):
201
201
return
202
202
203
203
# GH#10149
204
- cases = [klass ( second .values ) for klass in [ np . array , Series , list ] ]
204
+ cases = [second .to_numpy (), second . to_series (), second . to_list () ]
205
205
for case in cases :
206
- if not isinstance (index , CategoricalIndex ):
207
- result = first .union (case )
208
- assert tm .equalContents (result , everything ), (
209
- result ,
210
- everything ,
211
- type (case ),
212
- )
206
+ result = first .union (case )
207
+ assert tm .equalContents (result , everything )
213
208
214
209
if isinstance (index , MultiIndex ):
215
210
msg = "other must be a MultiIndex or a list of tuples"
@@ -227,16 +222,10 @@ def test_difference_base(self, sort, index):
227
222
assert tm .equalContents (result , answer )
228
223
229
224
# GH#10149
230
- cases = [klass ( second .values ) for klass in [ np . array , Series , list ] ]
225
+ cases = [second .to_numpy (), second . to_series (), second . to_list () ]
231
226
for case in cases :
232
- if isinstance (index , (DatetimeIndex , TimedeltaIndex )):
233
- assert type (result ) == type (answer )
234
- tm .assert_numpy_array_equal (
235
- result .sort_values ().asi8 , answer .sort_values ().asi8
236
- )
237
- else :
238
- result = first .difference (case , sort )
239
- assert tm .equalContents (result , answer )
227
+ result = first .difference (case , sort )
228
+ assert tm .equalContents (result , answer )
240
229
241
230
if isinstance (index , MultiIndex ):
242
231
msg = "other must be a MultiIndex or a list of tuples"
@@ -260,16 +249,9 @@ def test_symmetric_difference(self, index):
260
249
assert tm .equalContents (result , answer )
261
250
262
251
# GH#10149
263
- cases = [klass ( second .values ) for klass in [ np . array , Series , list ] ]
252
+ cases = [second .to_numpy (), second . to_series (), second . to_list () ]
264
253
for case in cases :
265
254
result = first .symmetric_difference (case )
266
-
267
- if is_datetime64tz_dtype (first ):
268
- # second.values casts to tznaive
269
- expected = first .union (case )
270
- tm .assert_index_equal (result , expected )
271
- continue
272
-
273
255
assert tm .equalContents (result , answer )
274
256
275
257
if isinstance (index , MultiIndex ):
0 commit comments