@@ -39,21 +39,17 @@ def test_intersection_base(idx, sort):
39
39
40
40
@pytest .mark .parametrize ("sort" , [None , False ])
41
41
def test_union_base (idx , sort ):
42
- first = idx [3 : ]
42
+ first = idx [:: - 1 ]
43
43
second = idx [:5 ]
44
- everything = idx
45
- union = first .union (second , sort = sort )
46
- if sort is None :
47
- tm .assert_index_equal (union , everything .sort_values ())
48
- assert tm .equalContents (union , everything )
49
44
50
- # GH 10149
51
- cases = [klass (second .values ) for klass in [np .array , Series , list ]]
52
- for case in cases :
53
- result = first .union (case , sort = sort )
45
+ array_like_cases = [klass (second .values ) for klass in [np .array , Series , list ]]
46
+ for case in [second , * array_like_cases ]:
47
+ union = first .union (case , sort = sort )
54
48
if sort is None :
55
- tm .assert_index_equal (result , everything .sort_values ())
56
- assert tm .equalContents (result , everything )
49
+ expected = first .sort_values ()
50
+ else :
51
+ expected = first
52
+ tm .assert_index_equal (union , expected )
57
53
58
54
msg = "other must be a MultiIndex or a list of tuples"
59
55
with pytest .raises (TypeError , match = msg ):
0 commit comments