From 17cb06a2f99603482f76804443e28b8e4411d0db Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Thu, 11 Jun 2026 11:41:19 +0000 Subject: [PATCH] =?UTF-8?q?Use=20lodged=20window=20geometry=20for=20rich?= =?UTF-8?q?=20RdSAP-Schema-18.0=20certs=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- .../domain/tests/test_from_rdsap_schema.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/datatypes/epc/domain/tests/test_from_rdsap_schema.py b/datatypes/epc/domain/tests/test_from_rdsap_schema.py index dd40a3ab..b111c3f0 100644 --- a/datatypes/epc/domain/tests/test_from_rdsap_schema.py +++ b/datatypes/epc/domain/tests/test_from_rdsap_schema.py @@ -1466,3 +1466,28 @@ class TestRdSap18_0ReducedFieldSynthesis: # Assert assert isinstance(result, EpcPropertyData) + + def test_rich_cert_uses_lodged_window_area_for_geometry(self) -> None: + # Arrange — ADR-0028: 10/1000 18.0 certs lodge a per-window sap_windows + # array (window_area as a Measurement), all band-4 ("much more glazed"). + # The placeholder 18.0 schema had NO sap_windows field, so this richest + # window data was dropped at parse and the cert modelled windowless. Those + # windows must use their lodged area as geometry (width = area, height = + # 1.0), not be synthesised. + corpus = _load_18_0_corpus() + if not corpus: + pytest.skip("no RdSAP-Schema-18.0 corpus harvested") + cert = next((c for c in corpus if c.get("sap_windows")), None) + if cert is None: + pytest.skip("no corpus cert lodging sap_windows") + lodged = cert["sap_windows"] + expected_total = sum(w["window_area"]["value"] for w in lodged) + + # Act + result = EpcPropertyDataMapper.from_api_response(cert) + + # Assert — one domain window per lodged window, total glazed area + # (width x height, height=1) preserved from the lodged measurement. + assert len(result.sap_windows) == len(lodged) + total_area = sum(w.window_width * w.window_height for w in result.sap_windows) + assert total_area == pytest.approx(expected_total)