diff --git a/inire/tests/test_routing_fixtures.py b/inire/tests/test_routing_fixtures.py index 5908a9b..7686f52 100644 --- a/inire/tests/test_routing_fixtures.py +++ b/inire/tests/test_routing_fixtures.py @@ -1,5 +1,4 @@ from dataclasses import replace -from itertools import combinations import pytest from shapely import union_all @@ -136,16 +135,21 @@ def _check_reference_paths(case) -> RoutingRunResult: assert run.metrics.nodes_expanded == 0 assert run.results_by_net.keys() == reference.keys() board = box(*problem.bounds) - footprints = [] + occupied = [polygon for fixed in problem.fixed_routes for polygon in fixed.polygons] + clearance = problem.clearance + separation = clearance - TOLERANCE_LINEAR * min(1.0, clearance) for result in run.results_by_net.values(): assert result.is_valid assert result.as_seed() == reference[result.net_id] footprint = union_all(result.locked_geometry) assert board.covers(footprint) - assert all(footprint.distance(obstacle) >= problem.clearance - TOLERANCE_LINEAR for obstacle in problem.static_obstacles) - footprints.append(footprint) - for a, b in combinations(footprints, 2): - assert a.distance(b) >= problem.clearance - TOLERANCE_LINEAR + if clearance: + assert all(footprint.distance(obstacle) >= separation for obstacle in problem.static_obstacles) + assert all(footprint.distance(other) >= separation for other in occupied) + else: + assert all(footprint.disjoint(obstacle) or footprint.touches(obstacle) for obstacle in problem.static_obstacles) + assert all(footprint.disjoint(other) for other in occupied) + occupied.append(footprint) return run