diff --git a/D03_PlanAnalysis/D03_PlanAnalysis_Layers.py b/D03_PlanAnalysis/D03_PlanAnalysis_Layers.py index 2e0b531a1..3e01d1ddc 100644 --- a/D03_PlanAnalysis/D03_PlanAnalysis_Layers.py +++ b/D03_PlanAnalysis/D03_PlanAnalysis_Layers.py @@ -181,7 +181,7 @@ def ensure_cadastral(processed: Path, box: Box, epsg: int) -> dict[str, Any]: atomic_write_json( key_path, { - "box": [round(v, 3) for v in box], + "box": [float(v) for v in box], "epsg": int(epsg), "count": len(features), "failed": failed, diff --git a/resources/tester/test_569_1_plan_layers.py b/resources/tester/test_569_1_plan_layers.py index d6a057a32..56fdf0019 100644 --- a/resources/tester/test_569_1_plan_layers.py +++ b/resources/tester/test_569_1_plan_layers.py @@ -112,6 +112,13 @@ def test_cadastral_fetch_once_then_grow(tmp_path, monkeypatch) -> None: assert fake.calls == 15 + 18 # 넓어지면 상자 통째로 다시(5.2 km = 6 × 3 조각) +def test_cadastral_same_odd_box_kept(tmp_path, monkeypatch) -> None: + monkeypatch.setattr(layers, "request_vworld_wfs", FakeWfs()) + odd = (243862.86880613962, 544271.5644142976, 245002.02265078452, 545528.8660732408) + assert layers.ensure_cadastral(tmp_path, odd, EPSG)["fetched"] + assert not layers.ensure_cadastral(tmp_path, odd, EPSG)["fetched"] # 소수 끝자리까지 같은 상자 + + def test_cadastral_failures(tmp_path, monkeypatch) -> None: monkeypatch.setattr(layers, "request_vworld_wfs", FakeWfs(fail=99)) with pytest.raises(RuntimeError):