Dispatch and map RdSAP-Schema-17.1 certs end-to-end 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jun-te Kim 2026-06-11 12:21:17 +00:00
parent cc0e875fd8
commit 4ea5367da6

View file

@ -1705,3 +1705,42 @@ class TestRdSap18_0ReducedFieldSynthesis:
# Assert
assert result.sap_heating.number_baths == expected_baths
assert result.sap_heating.mixer_shower_count == expected_mixers
# ---------------------------------------------------------------------------
# RdSAP 17.1 Reduced-Field Synthesis (ADR-0028 — inherit-and-validate). 17.1 is
# the same pre-SAP10 reduced family as 18.0/20.0.0 and reuses the same inherited
# 20.0.0 coefficients via the shared `_synthesise_reduced_field_windows` core;
# its own band-4 rich certs validate the transfer. Each test name pins one
# synthesis assumption (Validation-Cohort rule: no same-spec lodged figure).
# ---------------------------------------------------------------------------
_CORPUS_17_1 = os.path.join(
os.path.dirname(__file__),
"../../../../backend/epc_api/json_samples/RdSAP-Schema-17.1/corpus.jsonl",
)
def _load_17_1_corpus() -> list[Dict[str, Any]]:
if not os.path.exists(_CORPUS_17_1):
return []
with open(_CORPUS_17_1) as f:
return [json.loads(line) for line in f if line.strip()]
class TestRdSap17_1ReducedFieldSynthesis:
def test_cert_dispatches_and_maps_without_missing_required_field(self) -> None:
# Arrange — the placeholder 17.1 schema over-constrains (only 4/1000
# parse) and `from_api_response` never dispatched RdSAP-Schema-17.1.
# Dispatch + required→optional must let a real cert through end-to-end.
corpus = _load_17_1_corpus()
if not corpus:
pytest.skip("no RdSAP-Schema-17.1 corpus harvested")
cert = corpus[0]
# Act
result = EpcPropertyDataMapper.from_api_response(cert)
# Assert
assert isinstance(result, EpcPropertyData)