Keep a PasHub system-build wall off the basement cascade 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-14 21:53:21 +00:00
parent de15bd1ed7
commit 5980b2d6ed

View file

@ -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