@@ -55,8 +55,7 @@ def test_unary_ufunc(ufunc, sparse):
55
55
@pytest .mark .parametrize ("ufunc" , BINARY_UFUNCS )
56
56
@pytest .mark .parametrize ("sparse" , SPARSE , ids = SPARSE_IDS )
57
57
@pytest .mark .parametrize ("shuffle" , SHUFFLE )
58
- @pytest .mark .parametrize ("box_other" , [True , False ],
59
- ids = ['other-boxed' , 'other-raw' ])
58
+ @pytest .mark .parametrize ("box_other" , ['series' , 'index' , 'raw' ])
60
59
@pytest .mark .parametrize ("flip" , [True , False ],
61
60
ids = ['flipped' , 'straight' ])
62
61
def test_binary_ufunc (ufunc , sparse , shuffle , box_other ,
@@ -72,7 +71,13 @@ def test_binary_ufunc(ufunc, sparse, shuffle, box_other,
72
71
73
72
name = "name"
74
73
s1 = pd .Series (a1 , name = name )
75
- s2 = pd .Series (a2 , name = name )
74
+ if box_other == 'series' :
75
+ s2 = pd .Series (a2 , name = name )
76
+ elif box_other == 'index' :
77
+ # Index should defer to Series
78
+ s2 = pd .Index (a2 , naame = name )
79
+ else :
80
+ s2 = a2
76
81
77
82
# handle shufling / alignment
78
83
# If boxing -- ufunc(series, series) -- then we don't need to shuffle
@@ -95,6 +100,8 @@ def test_binary_ufunc(ufunc, sparse, shuffle, box_other,
95
100
96
101
result = ufunc (a , b )
97
102
expected = pd .Series (ufunc (c , d ), name = name )
103
+ if box_other == 'index' and flip :
104
+ raise pytest .xfail ("Index should defer to Series" )
98
105
tm .assert_series_equal (result , expected )
99
106
100
107
0 commit comments