Skip to content

Commit

Permalink
Add test for assert_interval_array_equal
Browse files Browse the repository at this point in the history
  • Loading branch information
serl committed Aug 23, 2024
1 parent 8cfbede commit 3ba3cd0
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion pandas/tests/util/test_assert_interval_array_equal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import pytest

from pandas import interval_range
from pandas import (
Interval,
interval_range,
)
import pandas._testing as tm
from pandas.arrays import IntervalArray


@pytest.mark.parametrize(
Expand Down Expand Up @@ -79,3 +83,18 @@ def test_interval_array_equal_start_mismatch():

with pytest.raises(AssertionError, match=msg):
tm.assert_interval_array_equal(arr1, arr2)


def test_interval_array_equal_end_mismatch_only():
arr1 = IntervalArray([Interval(0, 1), Interval(0, 5)])
arr2 = IntervalArray([Interval(0, 1), Interval(0, 6)])

msg = """\
IntervalArray.right are different
IntervalArray.right values are different \\(50.0 %\\)
\\[left\\]: \\[1, 5\\]
\\[right\\]: \\[1, 6\\]"""

with pytest.raises(AssertionError, match=msg):
tm.assert_interval_array_equal(arr1, arr2)

0 comments on commit 3ba3cd0

Please sign in to comment.