예제 #1
0
def test_intersection_is_symmetric(
):  # check expected result and symmetric property
    expected = IntervalSet((i.open(5, 6), ))
    first = IntervalSet((i.open(1, 2), i.open(4, 6)))
    second = IntervalSet((i.open(5, 7), i.open(12, 13)))
    assert first.intersection(second) == expected
    assert second.intersection(first) == expected
예제 #2
0
def test_intersection_of_equal():
    first = IntervalSet((i.open(1, 5), i.closed(7, 10)))
    result = first.intersection(first)
    assert result == first
예제 #3
0
def test_intersection_of_almost_overlapping():
    first = IntervalSet((i.open(1, 5), i.closedopen(7, 10)))
    second = IntervalSet((i.open(1, 5), i.closed(7,23)))
    expected = IntervalSet((i.open(1, 5), i.closedopen(7, 10)))
    result = first.intersection(second)
    assert result == expected
예제 #4
0
def test_intersection_of_disjoint_is_empty():
    first = IntervalSet((i.open(1, 5), i.closed(7, 10)))
    second = IntervalSet((i.open(20,21), i.closed(22,23)))
    expected = IntervalSet()
    result = first.intersection(second)
    assert result == expected
예제 #5
0
def test_intersection_is_symmetric():  # check expected result and symmetric property
    expected = IntervalSet((i.open(5, 6),))
    first = IntervalSet((i.open(1, 2), i.open(4, 6)))
    second = IntervalSet((i.open(5, 7), i.open(12, 13)))
    assert first.intersection(second) == expected
    assert second.intersection(first) == expected
예제 #6
0
def test_intersection_of_equal():
    first = IntervalSet((i.open(1, 5), i.closed(7, 10)))
    result = first.intersection(first)
    assert result == first
예제 #7
0
def test_intersection_of_almost_overlapping():
    first = IntervalSet((i.open(1, 5), i.closedopen(7, 10)))
    second = IntervalSet((i.open(1, 5), i.closed(7, 23)))
    expected = IntervalSet((i.open(1, 5), i.closedopen(7, 10)))
    result = first.intersection(second)
    assert result == expected
예제 #8
0
def test_intersection_of_disjoint_is_empty():
    first = IntervalSet((i.open(1, 5), i.closed(7, 10)))
    second = IntervalSet((i.open(20, 21), i.closed(22, 23)))
    expected = IntervalSet()
    result = first.intersection(second)
    assert result == expected