perf: accelerate regional building partitioning
This commit is contained in:
@@ -84,6 +84,41 @@ def test_partition_assignment_is_deterministic_and_has_no_cross_member_duplicate
|
||||
assert alpha_features[1]["properties"]["partition_assignment"] == "maximum_boundary_intersection"
|
||||
|
||||
|
||||
def test_interior_buildings_skip_regional_owner_scan(monkeypatch) -> None:
|
||||
operator = load_operator()
|
||||
scopes = importlib.import_module("geographic_scopes")
|
||||
member = scopes.ScopeMember("Alpha", "10001")
|
||||
boundary = Polygon([(0, 0), (1, 0), (1, 1), (0, 1)])
|
||||
scope = scopes.GeographicScope(
|
||||
key="single",
|
||||
display_name="Single",
|
||||
project_name="Single",
|
||||
project_region="Single",
|
||||
area_name="Single boundary",
|
||||
authority_name="Test",
|
||||
authority_url="https://example.test",
|
||||
scope_type="municipality",
|
||||
limitation_message="Test.",
|
||||
members=(member,),
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
operator,
|
||||
"assign_owner_nis",
|
||||
lambda *_args, **_kwargs: (_ for _ in ()).throw(AssertionError("interior feature used slow owner scan")),
|
||||
)
|
||||
|
||||
features, _ = operator.build_partition_features(
|
||||
[({"type": "FeatureCollection", "features": [feature("GBG.inside", Polygon([(0.1, 0.1), (0.2, 0.1), (0.2, 0.2), (0.1, 0.2)]))]}, "https://example.test/grb")],
|
||||
member=member,
|
||||
members=[(member, boundary)],
|
||||
regional_boundary=boundary,
|
||||
scope=scope,
|
||||
max_features=10,
|
||||
)
|
||||
|
||||
assert [item["id"] for item in features] == ["GBG.inside"]
|
||||
|
||||
|
||||
def test_combined_artifact_streams_partitions_and_rejects_duplicate_source_ids(tmp_path: Path) -> None:
|
||||
operator = load_operator()
|
||||
scope = importlib.import_module("geographic_scopes").KEMPEN_TRANSPORT_REGION_SCOPE
|
||||
|
||||
Reference in New Issue
Block a user