diff --git a/datatypes/epc/domain/tests/test_from_site_notes.py b/datatypes/epc/domain/tests/test_from_site_notes.py index 844a17a03..151fbbf1e 100644 --- a/datatypes/epc/domain/tests/test_from_site_notes.py +++ b/datatypes/epc/domain/tests/test_from_site_notes.py @@ -122,6 +122,32 @@ class TestPhotovoltaicArrayMapping: assert result.sap_energy_source.photovoltaic_arrays 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 + sentinel — with `wall_is_basement` left None, `main_wall_is_basement` + falls back to the code check and silently routes the dwelling through the + basement wall/floor cascade (issue #1590 bug 7). The mapper must pin the + flag False: a surveyed system-build wall is never a basement lodging. + """ + + def test_system_build_wall_does_not_route_to_basement(self) -> None: + # Arrange + data = load("pashub_rdsap_site_notes_example1.json") + data["building_construction"]["main_building"][ + "walls_construction_type" + ] = "System Build (i.e Any Other)" + survey = from_dict(PasHubRdSapSiteNotes, data) + + # Act + result = EpcPropertyDataMapper.from_site_notes(survey) + + # Assert — code 6, but explicitly NOT a basement. + part = result.sap_building_parts[0] + assert part.wall_construction == 6 + assert part.main_wall_is_basement is False + + class TestCylinderSizeCoding: """The surveyed §Water-Heating "Cylinder Size" label must resolve to the SAP10 cylinder-size enum (`_cylinder_volume_l_from_code` int-or-nones a raw