def _assert_none_same(x, y, err_msg, verbose): x_id = shapely.is_missing(x) y_id = shapely.is_missing(y) if not (x_id == y_id).all(): msg = build_err_msg( [x, y], err_msg + "\nx and y None location mismatch:", verbose=verbose, ) raise AssertionError(msg) # If there is a scalar, then here we know the array has the same # flag as it everywhere, so we should return the scalar flag. if x.ndim == 0: return bool(x_id) elif y.ndim == 0: return bool(y_id) else: return y_id
def test_get_exterior_ring_non_polygon(geom): actual = shapely.get_exterior_ring(geom) assert shapely.is_missing(actual).all()
def test_empty(): """Compatibility with empty_like, see GH373""" g = np.empty_like(np.array([None, None])) assert shapely.is_missing(g).all()
def test_get_point(geom): n = shapely.get_num_points(geom) actual = shapely.get_point(geom, [0, -n, n, -(n + 1)]) assert_geometries_equal(actual[0], actual[1]) assert shapely.is_missing(actual[2:4]).all()
def test_get_point_non_linestring(geom): actual = shapely.get_point(geom, [0, 2, -1]) assert shapely.is_missing(actual).all()
def test_get_geometry_simple(geom): actual = shapely.get_geometry(geom, [0, -1, 1, -2]) assert_geometries_equal(actual[0], actual[1]) assert shapely.is_missing(actual[2:4]).all()
def test_get_interior_ring(): actual = shapely.get_interior_ring(polygon_with_hole, [0, -1, 1, -2]) assert_geometries_equal(actual[0], actual[1]) assert shapely.is_missing(actual[2:4]).all()
def test_empty(geom_type): actual = shapely.empty((2, ), geom_type=geom_type) assert (~shapely.is_missing(actual)).all() assert shapely.is_empty(actual).all() assert (shapely.get_type_id(actual) == geom_type).all()
def test_empty_missing(geom_type): actual = shapely.empty((2, ), geom_type=geom_type) assert shapely.is_missing(actual).all()