예제 #1
0
def test_super_sub_range_exclusive():
    for _ in range(1000):
        part = u.get_rand_range_part()
        x = u.get_rand_int_below_exclusive(part.a)
        y = u.get_rand_int_above_exclusive(part.b)
        other = RangePart(x, y)
        assert other.is_super_range(part) and part.is_sub_range(other)
        assert other > part and part < other and part != other
예제 #2
0
def test_super_sub_range():
    for _ in range(1000):
        part = u.get_rand_range_part()
        x = u.get_rand_int_below_exclusive(part.a)
        y = u.get_rand_int_above_exclusive(part.b)
        other = RangePart(x, y)
        diff = [RangePart(other.a, part.a), RangePart(part.b, other.b)]
        assert other.a < part.a < part.b < other.b
        assert other.is_super_range(part)
        assert part.is_sub_range(other)
        assert part - other == other - part == diff