mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Use lodged window area for the 7 rich 20.0.0 certs' geometry 🟩
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
12ff15e55b
commit
c0b8a7d9f8
2 changed files with 33 additions and 2 deletions
|
|
@ -1206,8 +1206,14 @@ class EpcPropertyDataMapper:
|
|||
orientation=w.orientation,
|
||||
window_type=w.window_type,
|
||||
glazing_type=w.glazing_type,
|
||||
window_width=0.0,
|
||||
window_height=0.0,
|
||||
# ADR-0027: the 7 rich certs lodge a real per-window
|
||||
# window_area (Measurement) — use it directly as
|
||||
# geometry (width = area, height = 1.0, matching the
|
||||
# synthesis convention) rather than the placeholder
|
||||
# windowless 0x0 that modelled these data-richest certs
|
||||
# as having no glazing at all.
|
||||
window_width=_measurement_value(w.window_area),
|
||||
window_height=1.0,
|
||||
draught_proofed=False,
|
||||
window_location=w.window_location,
|
||||
window_wall_type=0,
|
||||
|
|
|
|||
|
|
@ -1399,3 +1399,28 @@ class TestRdSap20_0_0ReducedFieldSynthesis:
|
|||
|
||||
# Assert
|
||||
assert isinstance(result, EpcPropertyData)
|
||||
|
||||
def test_rich_cert_uses_lodged_window_area_for_geometry(self) -> None:
|
||||
# Arrange — ADR-0027: 7/1000 certs DO lodge a per-window sap_windows
|
||||
# array (window_area as a Measurement). Those windows must use their
|
||||
# lodged area as geometry (width = area, height = 1.0) rather than being
|
||||
# synthesised — and must NOT be modelled windowless (width=height=0,
|
||||
# the prior placeholder behaviour for the certs that actually carry the
|
||||
# richest window data).
|
||||
corpus = _load_20_0_0_corpus()
|
||||
if not corpus:
|
||||
pytest.skip("no RdSAP-Schema-20.0.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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue