Include address and postcode in floor-dims synthesis ValueError for triage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-06-25 15:07:07 +00:00
parent 8024065d04
commit 5a4285e1b7
2 changed files with 9 additions and 4 deletions

View file

@ -805,6 +805,8 @@ class EpcPropertyDataMapper:
total_floor_area=float(schema.total_floor_area),
is_single_part=len(schema.sap_building_parts) == 1,
is_flat=schema.sap_flat_details is not None,
address_line_1=schema.address_line_1,
postcode=schema.postcode,
)
for i, bp in enumerate(schema.sap_building_parts)
],
@ -2914,6 +2916,8 @@ def _sap_17_1_building_part(
total_floor_area: float,
is_single_part: bool,
is_flat: bool,
address_line_1: str,
postcode: str,
) -> SapBuildingPart:
"""D1: build one `SapBuildingPart`, deriving the heat-loss perimeter and
party-wall length the engine needs from the measured wall areas full SAP
@ -2970,9 +2974,10 @@ def _sap_17_1_building_part(
else:
if not bp.sap_floor_dimensions:
raise ValueError(
f"building_part {bp.building_part_number!r}: sap_floor_dimensions "
f"is empty and cannot be synthesised (is_single_part={is_single_part}, "
f"is_flat={is_flat})"
f"{address_line_1!r}, {postcode!r}, "
f"building_part {bp.building_part_number!r}: "
f"sap_floor_dimensions is empty and cannot be synthesised "
f"(is_single_part={is_single_part}, is_flat={is_flat})"
)
floor_dimensions = [
SapFloorDimension(

View file

@ -827,5 +827,5 @@ class TestFullSapSchema16xNoFloorDimensions:
data.pop("sap_flat_details", None)
# Act / Assert
with pytest.raises(ValueError, match="sap_floor_dimensions"):
with pytest.raises(ValueError, match="Wardalls Grove.*SE14 5FB.*sap_floor_dimensions"):
EpcPropertyDataMapper.from_api_response(data)