Skip to content

Commit 4c0c893

Browse files
committed
Add test for assert_interval_array_equal
1 parent c6dfe24 commit 4c0c893

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

pandas/tests/util/test_assert_interval_array_equal.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import pytest
22

3-
from pandas import interval_range
3+
from pandas import (
4+
Interval,
5+
interval_range,
6+
)
47
import pandas._testing as tm
8+
from pandas.arrays import IntervalArray
59

610

711
@pytest.mark.parametrize(
@@ -79,3 +83,18 @@ def test_interval_array_equal_start_mismatch():
7983

8084
with pytest.raises(AssertionError, match=msg):
8185
tm.assert_interval_array_equal(arr1, arr2)
86+
87+
88+
def test_interval_array_equal_end_mismatch_only():
89+
arr1 = IntervalArray([Interval(0, 1), Interval(0, 5)])
90+
arr2 = IntervalArray([Interval(0, 1), Interval(0, 6)])
91+
92+
msg = """\
93+
IntervalArray.right are different
94+
95+
IntervalArray.right values are different \\(50.0 %\\)
96+
\\[left\\]: \\[1, 5\\]
97+
\\[right\\]: \\[1, 6\\]"""
98+
99+
with pytest.raises(AssertionError, match=msg):
100+
tm.assert_interval_array_equal(arr1, arr2)

0 commit comments

Comments
 (0)