@@ -398,13 +398,16 @@ def test_astype_preserves_name(self, index, dtype, copy):
398
398
assert result .name == index .name
399
399
400
400
401
- @pytest .mark .parametrize ("exp_arr, sort " , [( [0 , 1 , 4 , 3 ], False ), ([ 0 , 1 , 3 , 4 ], True ) ])
401
+ @pytest .mark .parametrize ("arr " , [[0 , 1 , 4 , 3 ]])
402
402
@pytest .mark .parametrize ("dtype" , ["int8" , "int16" , "int32" , "int64" ])
403
- def test_union_index_no_sort (exp_arr , sort , dtype ):
403
+ def test_union_index_no_sort (arr , sort , dtype ):
404
404
# GH 35092. Check that we don't sort with sort=False
405
- ind1 = Index ([ 0 , 1 ], dtype = dtype )
406
- ind2 = Index ([ 4 , 3 ], dtype = dtype )
405
+ ind1 = Index (arr [: 2 ], dtype = dtype )
406
+ ind2 = Index (arr [ 2 : ], dtype = dtype )
407
407
408
- expected = Index (exp_arr , dtype = dtype )
408
+ # sort is None indicates that we sort the combined index
409
+ if sort is None :
410
+ arr .sort ()
411
+ expected = Index (arr , dtype = dtype )
409
412
result = union_indexes ([ind1 , ind2 ], sort = sort )
410
413
tm .assert_index_equal (result , expected )
0 commit comments