示例#1
0
def test_right_overlap_in_range():
    for _ in range(1000):
        part = u.get_rand_range_part()
        x = u.get_rand_int_in_range(part.a, part.b)
        y = u.get_rand_int_above_exclusive(part.b)
        other = RangePart(x, y)
        assert part.a < other.a < part.b < other.b
        assert part.right_overlap_with(other) and other.left_overlap_with(part)
示例#2
0
def test_no_overlap():
    for _ in range(1000):
        part = u.get_rand_range_part()
        x = u.get_rand_int_above_exclusive(part.b)
        y = u.get_rand_int_above_exclusive(x)
        other = RangePart(x, y)
        assert not other.right_overlap_with(
            part) and not other.left_overlap_with(part)
        assert other > part and part < other and part != other