mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Guard build_property_report against None from unmapped-schema certs
from_api_response now returns None for an unsupported schema_type instead of raising, so the harness must check before dereferencing the mapped EpcPropertyData — otherwise an AttributeError replaces the expected ValueError in calculator_error. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
b540cf1ca2
commit
b1467a6b2f
1 changed files with 2 additions and 0 deletions
|
|
@ -196,6 +196,8 @@ def build_property_report(
|
|||
name: str = path.stem
|
||||
try:
|
||||
epc = EpcPropertyDataMapper.from_api_response(json.loads(path.read_text()))
|
||||
if epc is None:
|
||||
raise ValueError("Unsupported or unrecognised EPC schema")
|
||||
lodged_sap: Optional[int] = epc.energy_rating_current
|
||||
calculated_sap: float = Sap10Calculator().calculate(epc).sap_score_continuous
|
||||
except Exception as error: # noqa: BLE001 — one bad cert must not abort the report
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue