From debbbb84f2e836bedeb7b704e3bfa77fed6ecc41 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 26 Jun 2026 08:12:52 +0000 Subject: [PATCH] =?UTF-8?q?Map=20mechanical=5Fventilation=5Fkind=20in=20th?= =?UTF-8?q?e=203=20bare-SapVentilation=20RdSAP=20mappers=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 | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/datatypes/epc/domain/tests/test_from_rdsap_schema.py b/datatypes/epc/domain/tests/test_from_rdsap_schema.py index a8d5261f..a817414c 100644 --- a/datatypes/epc/domain/tests/test_from_rdsap_schema.py +++ b/datatypes/epc/domain/tests/test_from_rdsap_schema.py @@ -2702,3 +2702,30 @@ def test_rdsap_mappers_carry_main_heating_controls_display( assert result.main_heating_controls is not None assert result.main_heating_controls.description == expected + + +@pytest.mark.parametrize( + "schema_cls, mapper, fixture", + [ + (RdSapSchema17_1, EpcPropertyDataMapper.from_rdsap_schema_17_1, "17_1.json"), + (RdSapSchema18_0, EpcPropertyDataMapper.from_rdsap_schema_18_0, "18_0.json"), + (RdSapSchema20_0_0, EpcPropertyDataMapper.from_rdsap_schema_20_0_0, "20_0_0.json"), + ], +) +def test_rdsap_mappers_map_mechanical_ventilation_kind( + schema_cls: Any, mapper: Any, fixture: str +) -> None: + # Calc-facing: an MVHR cert (mechanical_ventilation=4) must reach the §2 + # ventilation cascade as MVHR, not be silently treated as natural. These + # three build a bare SapVentilation(sheltered_sides=…) and dropped the + # top-level mechanical_ventilation; 17.0 + 21.0.1 + full-SAP already map it + # (via _sap_17_1_ventilation / their own wiring). 19.0 + 21.0.0 set no + # sap_ventilation at all — a bigger, separate gap (see followups). Natural + # certs (code 0/5 → None) are unchanged, so the fix only moves genuine + # MEV/MVHR certs (ADR-0037 follow-up). + data = load(fixture) + data["mechanical_ventilation"] = 4 + + result = mapper(from_dict(schema_cls, data)) + + assert result.sap_ventilation.mechanical_ventilation_kind == "MVHR"