def test_point_outside(): p = Polygon([Point(0, 0), Point(0, 10), Point(10, 10), Point(10, 0)]) assert not p.point_inside(Point(-1, -1))
def test_outline(): p = Polygon([Point(0, 0), Point(0, 1), Point(1, 0)]) assert 3 == len(list(p.outline()))
def test_point_inside(): p = Polygon([Point(0, 0), Point(0, 10), Point(10, 10), Point(10, 0)]) assert p.point_inside(Point(5, 5))
def test_less_than_three_points(): with pytest.raises(ValueError): Polygon([Point(0, 0), Point(1, 0)])
def test_empty_points(): with pytest.raises(ValueError): Polygon(())
def test_float_points(): # Should this fail? Not checking right now Polygon([Point(0.001, 0), Point(0, 1.1), Point(0, 0)])
def test_non_unique_point(): with pytest.raises(ValueError): Polygon([Point(0, 0), Point(0, 1), Point(0, 0)])
def test_three_unique_points(): Polygon([Point(0, 0), Point(0, 1), Point(1, 0)])