masque/masque/test/test_shape_ordering.py

15 lines
361 B
Python

from ..shapes import Circle, Ellipse, Polygon
def test_shape_comparisons() -> None:
c1 = Circle(radius=10)
c2 = Circle(radius=20)
assert c1 < c2
assert not (c2 < c1)
p1 = Polygon([[0, 0], [10, 0], [10, 10]])
p2 = Polygon([[0, 0], [10, 0], [10, 11]])
assert p1 < p2
assert c1 < p1 or p1 < c1
assert (c1 < p1) != (p1 < c1)