Ejemplo n.º 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
Ejemplo n.º 2
0
def test_intersection_of_equal():
    first = IntervalSet((i.open(1, 5), i.closed(7, 10)))
    result = first.intersection(first)
    assert result == first
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 6
0
def test_intersection_of_equal():
    first = IntervalSet((i.open(1, 5), i.closed(7, 10)))
    result = first.intersection(first)
    assert result == first
Ejemplo n.º 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
Ejemplo n.º 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