Example #1
0
def test_interval_union_issubset_error():
    iu = IntervalUnion([[0, 10], [20, 30], [40, 50]])
    with pytest.raises(Exception) as exinfo:
        assert iu.issubset([[0, 100]])
    msg = (
        "issubset is only defined on Interval and IntervalUnion, "
        "but <class 'list'> was given"
    )
    assert str(exinfo.value) == msg
Example #2
0
def test_interval_union_issubset_part():
    iu1 = IntervalUnion([[0, 10], [20, 30], [40, 50]])
    iu2 = IntervalUnion([[20, 30], [40, 50]])
    assert not iu1.issubset(iu2)
    assert iu2.issubset(iu1)
Example #3
0
def test_interval_union_issubset_not():
    iu = IntervalUnion([[0, 10], [20, 30], [40, 50]])
    interval = Interval(12, 14)
    assert not iu.issubset(interval)
    assert not interval.issubset(iu)