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"] + )