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