@@ -2418,10 +2418,16 @@ def test_diff_low_precision_int(self, dtype):
2418
2418
tm .assert_numpy_array_equal (result , expected )
2419
2419
2420
2420
2421
- def test_union_with_duplicates ():
2421
+ @pytest .mark .parametrize ("op" , [np .array , pd .array ])
2422
+ def test_union_with_duplicates (op ):
2422
2423
# GH#36289
2423
- lvals = np .array ([3 , 1 , 3 , 4 ])
2424
- rvals = np .array ([2 , 3 , 1 , 1 ])
2425
- result = algos .union_with_duplicates (lvals , rvals )
2426
- expected = np .array ([3 , 3 , 1 , 1 , 4 , 2 ])
2427
- tm .assert_numpy_array_equal (result , expected )
2424
+ lvals = op ([3 , 1 , 3 , 4 ])
2425
+ rvals = op ([2 , 3 , 1 , 1 ])
2426
+ expected = op ([3 , 3 , 1 , 1 , 4 , 2 ])
2427
+ if isinstance (expected , np .ndarray ):
2428
+ result = algos .union_with_duplicates (lvals , rvals )
2429
+ tm .assert_numpy_array_equal (result , expected )
2430
+ else :
2431
+ with tm .assert_produces_warning (RuntimeWarning ):
2432
+ result = algos .union_with_duplicates (lvals , rvals )
2433
+ tm .assert_extension_array_equal (result , expected )
0 commit comments