Skip to content

Commit 0b1e745

Browse files
committed
xfail ufunc(series, index)
1 parent e179913 commit 0b1e745

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pandas/tests/series/test_ufunc.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ def test_unary_ufunc(ufunc, sparse):
5555
@pytest.mark.parametrize("ufunc", BINARY_UFUNCS)
5656
@pytest.mark.parametrize("sparse", SPARSE, ids=SPARSE_IDS)
5757
@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'])
6059
@pytest.mark.parametrize("flip", [True, False],
6160
ids=['flipped', 'straight'])
6261
def test_binary_ufunc(ufunc, sparse, shuffle, box_other,
@@ -72,7 +71,13 @@ def test_binary_ufunc(ufunc, sparse, shuffle, box_other,
7271

7372
name = "name"
7473
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
7681

7782
# handle shufling / alignment
7883
# 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,
95100

96101
result = ufunc(a, b)
97102
expected = pd.Series(ufunc(c, d), name=name)
103+
if box_other == 'index' and flip:
104+
raise pytest.xfail("Index should defer to Series")
98105
tm.assert_series_equal(result, expected)
99106

100107

0 commit comments

Comments
 (0)