diff --git a/datatypes/epc/domain/tests/test_from_site_notes.py b/datatypes/epc/domain/tests/test_from_site_notes.py index b5bc4f29b..77c7ed4fd 100644 --- a/datatypes/epc/domain/tests/test_from_site_notes.py +++ b/datatypes/epc/domain/tests/test_from_site_notes.py @@ -297,6 +297,56 @@ class TestRoomInRoofMapping: ] +class TestWallDryLinedMapping: + """A surveyed "Wall Dry-Lined? Yes" must reach + `sap_building_parts[*].wall_dry_lined` โ€” the flag the wall-U cascade + reads for the RdSAP10 ยง5.8 / Table 14 adjustment (1/(1/U + 0.17)). + Dropped, a dry-lined wall is billed at the full uninsulated Table 6 U + (19% of the Guinness accuracy cohort lodges a "Yes"; already mapped on + the Elmhurst/API path, silently None on the pashub site-notes path).""" + + def test_main_building_answer_reaches_building_part(self) -> None: + # Arrange + data = load("pashub_rdsap_site_notes_example1.json") + data["building_construction"]["main_building"]["dry_lined"] = True + survey = from_dict(PasHubRdSapSiteNotes, data) + + # Act + result = EpcPropertyDataMapper.from_site_notes(survey) + + # Assert + assert result.sap_building_parts[0].wall_dry_lined is True + + def test_extension_answer_reaches_building_part(self) -> None: + # Arrange + data = load("pashub_rdsap_site_notes_example2.json") + data["building_construction"]["extensions"][0]["dry_lined"] = False + survey = from_dict(PasHubRdSapSiteNotes, data) + + # Act + result = EpcPropertyDataMapper.from_site_notes(survey) + + # Assert + extension_part = next( + bp + for bp in result.sap_building_parts + if bp.identifier != BuildingPartIdentifier.MAIN + ) + assert extension_part.wall_dry_lined is False + + def test_not_asked_stays_unknown(self) -> None: + # Arrange โ€” the fixture as lodged (no "Wall Dry-Lined?" answer). + survey = from_dict( + PasHubRdSapSiteNotes, load("pashub_rdsap_site_notes_example1.json") + ) + + # Act + result = EpcPropertyDataMapper.from_site_notes(survey) + + # Assert โ€” unknown, NOT a "No". + assert result.sap_building_parts[0].wall_dry_lined is None + + class TestSystemBuildWallIsNotBasement: """RdSAP wall-construction code 6 is overloaded: PasHub "System Build (i.e Any Other)" maps to 6, but 6 doubles as the gov-API basement-wall