From afdf85176d47b19c83a10fd190ae3eb0cc9cb636 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Thu, 11 Jun 2026 12:01:13 +0000 Subject: [PATCH] =?UTF-8?q?Map=20chimneys,=20draughtproofing=20and=20shelt?= =?UTF-8?q?ered=20sides=20for=2018.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 | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/datatypes/epc/domain/tests/test_from_rdsap_schema.py b/datatypes/epc/domain/tests/test_from_rdsap_schema.py index f5077eac..49932030 100644 --- a/datatypes/epc/domain/tests/test_from_rdsap_schema.py +++ b/datatypes/epc/domain/tests/test_from_rdsap_schema.py @@ -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"] + )