From 6df307b49c0076cffa177222a49a08042fa72504 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Thu, 11 Jun 2026 12:02:16 +0000 Subject: [PATCH] =?UTF-8?q?Derive=20hot-water=20bath=20and=20mixer=20count?= =?UTF-8?q?s=20from=20room=20counts=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 49932030..6afea563 100644 --- a/datatypes/epc/domain/tests/test_from_rdsap_schema.py +++ b/datatypes/epc/domain/tests/test_from_rdsap_schema.py @@ -1671,3 +1671,37 @@ class TestRdSap18_0ReducedFieldSynthesis: assert result.sap_ventilation.sheltered_sides == _api_sheltered_sides( cert["built_form"] ) + + def test_hot_water_derives_bath_and_mixer_counts_from_room_counts(self) -> None: + # Arrange — ADR-0028: 18.0's instantaneous_wwhrs carries bath/shower ROOM + # counts (a false-friend for the WWHR device index), populated 1000/1000. + # Derive number_baths and mixer_shower_count so HW demand isn't pinned to + # the calculator's modal 1-bath default. + 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("sap_heating", {}).get("instantaneous_wwhrs") + ), + None, + ) + if cert is None: + pytest.skip("no corpus cert with instantaneous_wwhrs") + iw = cert["sap_heating"]["instantaneous_wwhrs"] + expected_baths = iw["rooms_with_bath_and_or_shower"] + iw[ + "rooms_with_bath_and_mixer_shower" + ] + expected_mixers = iw["rooms_with_mixer_shower_no_bath"] + iw[ + "rooms_with_bath_and_mixer_shower" + ] + + # Act + result = EpcPropertyDataMapper.from_api_response(cert) + + # Assert + assert result.sap_heating.number_baths == expected_baths + assert result.sap_heating.mixer_shower_count == expected_mixers