From 7f854e721924e1196cafb0fca90ba508aa7fb6b6 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 14 Jul 2026 23:17:30 +0000 Subject: [PATCH] =?UTF-8?q?Withhold=20roof=20insulation=20from=20RIR=20sur?= =?UTF-8?q?faces=20the=20surveyor=20marked=20insulation-unknown=20?= =?UTF-8?q?=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .../epc/domain/tests/test_from_site_notes.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/datatypes/epc/domain/tests/test_from_site_notes.py b/datatypes/epc/domain/tests/test_from_site_notes.py index 83cadc038..b5bc4f29b 100644 --- a/datatypes/epc/domain/tests/test_from_site_notes.py +++ b/datatypes/epc/domain/tests/test_from_site_notes.py @@ -252,6 +252,50 @@ class TestRoomInRoofMapping: # Assert assert result.sap_building_parts[0].sap_room_in_roof is None + def test_insulation_not_threaded_when_surveyor_answered_not_known( + self, + ) -> None: + """On the survey form that asks per surface "Are you able to provide + details of the insulation …?", a "No" means the surveyor could NOT + confirm insulation for that surface (fixture 499617935574: loft hatch + screwed shut) — the roof-space thickness must not be threaded into it, + leaving the Table 18 col(4) age-band "unknown" default. Common walls + are never asked on this form, so they stay unthreaded too. The + legacy form (no question lodged anywhere; the `_RIR` fixture above) + keeps threading — pinned by `test_room_in_roof_reaches_building_part`. + """ + # Arrange — the verbatim 499617935574 answers: gables Yes, slopes and + # flat ceiling No, common walls never asked. + data = load("pashub_rdsap_site_notes_example1.json") + data["roof_space"]["main_building"]["rooms_in_roof"] = True + rir = json.loads(json.dumps(self._RIR)) + for gable in rir["gables"]: + gable["insulation_known"] = True + for slope in rir["slopes"]: + slope["insulation_known"] = False + rir["flat_ceilings"][0]["insulation_known"] = False + data["roof_space"]["main_building"]["room_in_roof"] = rir + survey = from_dict(PasHubRdSapSiteNotes, data) + + # Act + mapped = EpcPropertyDataMapper.from_site_notes(survey).sap_building_parts[ + 0 + ].sap_room_in_roof + + # Assert + assert mapped is not None + surfaces = mapped.detailed_surfaces + assert surfaces is not None + assert [(s.kind, s.insulation_thickness_mm) for s in surfaces] == [ + ("gable_wall_external", None), + ("gable_wall", None), + ("slope", None), + ("slope", None), + ("stud_wall", None), + ("stud_wall", None), + ("flat_ceiling", None), + ] + class TestSystemBuildWallIsNotBasement: """RdSAP wall-construction code 6 is overloaded: PasHub "System Build