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))
Exemple #2
0
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))
Exemple #4
0
def test_less_than_three_points():
    with pytest.raises(ValueError):
        Polygon([Point(0, 0), Point(1, 0)])
Exemple #5
0
def test_empty_points():
    with pytest.raises(ValueError):
        Polygon(())
Exemple #6
0
def test_float_points():
    # Should this fail? Not checking right now
    Polygon([Point(0.001, 0), Point(0, 1.1), Point(0, 0)])
Exemple #7
0
def test_non_unique_point():
    with pytest.raises(ValueError):
        Polygon([Point(0, 0), Point(0, 1), Point(0, 0)])
Exemple #8
0
def test_three_unique_points():
    Polygon([Point(0, 0), Point(0, 1), Point(1, 0)])