Last active
August 2, 2020 14:18
-
-
Save MartinThoma/cb1fb7fdfb0e409dfe40c7f50a6e0458 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hypothesis import given, strategies as st | |
from mpu.datastructures import Interval | |
@given(st.lists(st.integers(), min_size=4, max_size=4).map(sorted)) | |
def test_interval_issubset(integer_list): | |
a, b, c, d = integer_list | |
assert Interval(b, c).issubset(Interval(a, d)) | |
@given(st.lists(st.integers(), min_size=4, max_size=4).map(sorted)) | |
def test_interval_issubset_not(integer_list): | |
a, b, c, d = integer_list | |
assert not Interval(a, b).issubset(Interval(c, d)) or c <= a <= b <= d | |
assert not Interval(a, c).issubset(Interval(b, d)) or b <= a <= c <= d | |
assert not Interval(c, d).issubset(Interval(a, b)) or a <= c <= d <= b | |
assert not Interval(b, d).issubset(Interval(a, c)) or a <= b <= d <= c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment