Skip to content

Commit 7a5dac4

Browse files
committed
TST: Add test for operations on DataFrame with Interval CategoricalIndex
1 parent a101f9e commit 7a5dac4

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

pandas/tests/frame/test_arithmetic.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -647,13 +647,9 @@ def test_operations_with_interval_categories_index(self, all_arithmetic_operator
647647
# GH#27415
648648
op = all_arithmetic_operators
649649
ind = pd.CategoricalIndex(pd.interval_range(start=0.0, end=2.0))
650-
651-
df = pd.DataFrame([[1, 2]], columns=ind)
652-
num = 100
653-
try:
654-
getattr(df, op)(num)
655-
except TypeError:
656-
pytest.fail(
657-
"Unexpected TypeError for operations on DataFrame\
658-
with interval categories as index"
659-
)
650+
data = [1, 2]
651+
df = pd.DataFrame([data], columns=ind)
652+
num = 10
653+
result = getattr(df, op)(num)
654+
expected = pd.DataFrame([[getattr(n, op)(num) for n in data]], columns=ind)
655+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)