Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_warns_for_overlaps(self, squares_some_neat_some_overlapping):
with pytest.warns(OverlapWarning):
adjacencies(squares_some_neat_some_overlapping)
raise ValueError('adjacency_type must be "rook" or "queen"')
index, geoms = zip(*iter_adjacencies(geometries))
inters = GeoSeries(geoms, index=index, crs=geometries.crs)
if adjacency_type == "rook":
inters = inters[inters.length > 0]
if warn_for_overlaps:
overlaps = inters[inters.area > 0]
if len(overlaps) > 0:
warnings.warn(
"Found overlapping polygons while computing adjacencies.\n"
"This could be evidence of topological problems.\n"
"Indices of overlaps: {}".format(set(overlaps.index)),
OverlapWarning,
)
if warn_for_islands:
islands = set(geometries.index) - set(i for pair in inters.index for i in pair)
if len(islands) > 0:
warnings.warn(
"Found islands.\n" "Indices of islands: {}".format(islands),
IslandWarning,
)
return inters