@@ -39,21 +39,17 @@ def test_intersection_base(idx, sort):
3939
4040@pytest .mark .parametrize ("sort" , [None , False ])
4141def test_union_base (idx , sort ):
42- first = idx [3 : ]
42+ first = idx [:: - 1 ]
4343 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 )
4944
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 )
5448 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 )
5753
5854 msg = "other must be a MultiIndex or a list of tuples"
5955 with pytest .raises (TypeError , match = msg ):
0 commit comments