Map chimneys, draughtproofing and sheltered sides for 18.0 certs 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jun-te Kim 2026-06-11 12:01:13 +00:00
parent 2b5d596f9b
commit afdf85176d

View file

@ -1637,3 +1637,37 @@ class TestRdSap18_0ReducedFieldSynthesis:
# Assert
assert result.incandescent_fixed_lighting_bulbs_count == total - low
assert result.low_energy_fixed_lighting_bulbs_count == low
def test_ventilation_maps_chimneys_draughtproofing_and_sheltered_sides(
self,
) -> None:
# Arrange — ADR-0028: 18.0 lodges open_fireplaces_count (else dropped),
# percent_draughtproofed, and built_form. Build sap_ventilation with
# sheltered_sides from built_form (else the calculator defaults every
# dwelling to mid-terrace=2). A cert with an open fireplace.
from datatypes.epc.domain.mapper import _api_sheltered_sides # pyright: ignore[reportPrivateUsage]
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 not c.get("sap_windows") and (c.get("open_fireplaces_count") or 0) >= 1
),
None,
)
if cert is None:
pytest.skip("no corpus cert with an open fireplace")
# Act
result = EpcPropertyDataMapper.from_api_response(cert)
# Assert
assert result.open_chimneys_count == cert["open_fireplaces_count"]
assert result.percent_draughtproofed == cert["percent_draughtproofed"]
assert result.sap_ventilation is not None
assert result.sap_ventilation.sheltered_sides == _api_sheltered_sides(
cert["built_form"]
)