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