def test_point_on_boundary(point):
    """
    tests points that are on the boundaries between two polygons
    it should be computed as being only in one and only one of them
    """
    p1 = point_in_poly(poly1_ccw, np.asarray(point, dtype=np.float64))
    p2 = point_in_poly(poly2_ccw, np.asarray(point, dtype=np.float64))
    assert p1 ^ p2 # bitwise xor -- these should be integer 1 or 0
def test_non_contiguous_poly():
    """
    a non-contiguous poly should fail
    """
    poly = np.zeros((5,4), dtype=np.float64)
    # make non-contiguous
    poly = poly[:,2:]
    print poly.flags

    with pytest.raises(ValueError):
        result = point_in_poly(poly, (3,4) )
def test_point_in_poly(point):
    """
    tests points that should be in the polygon
    """
    assert point_in_poly(poly2_ccw, np.asarray(point, dtype=np.float64))
    assert point_in_poly(poly2_cw, np.asarray(point, dtype=np.float64))
def test_point_not_in_poly2(point):
    """
    points that are in poly1 should not be in poly2
    """
    assert not point_in_poly(poly2_ccw, np.asarray(point, dtype=np.float64))
    assert not point_in_poly(poly2_cw, np.asarray(point, dtype=np.float64))
def test_point_in_poly(point):
    """
    tests points that should be in the polygon
    """
    assert point_in_poly(poly1_ccw, point)
    assert point_in_poly(poly1_cw, point)