diff --git a/datatypes/epc/domain/mapper.py b/datatypes/epc/domain/mapper.py index a699be4e..380192d3 100644 --- a/datatypes/epc/domain/mapper.py +++ b/datatypes/epc/domain/mapper.py @@ -6942,6 +6942,12 @@ _ELMHURST_GLAZING_LABEL_TO_SAP10: Dict[str, int] = { "Single glazing": 1, "Double pre 2002": 2, "Double between 2002 and 2021": 3, + # Year-truncated form of "Double between 2002 and 2021": the trailing + # "and 2021" wraps to an adjacent PDF table cell that the extractor + # joins away (same artifact as "Triple post or during" below). Same + # SAP 10.2 code 3 (DG 2002-2021) — surfaced on the simulated-case-46 + # multi-attribute worksheet. + "Double between 2002": 3, "Double with unknown install date": 3, "Double with unknown 16 mm or install date more": 3, # Elmhurst §11 lodgement of RdSAP-21 schema row 7 "double, known diff --git a/tests/datatypes/epc/domain/test_mapper_glazing_label.py b/tests/datatypes/epc/domain/test_mapper_glazing_label.py new file mode 100644 index 00000000..8430d76e --- /dev/null +++ b/tests/datatypes/epc/domain/test_mapper_glazing_label.py @@ -0,0 +1,26 @@ +"""Mapper boundary: the Elmhurst §11 "Double between 2002" glazing label. + +The full RdSAP-Schema-21 label is "Double between 2002 and 2021" (SAP 10.2 +Table 24 code 3 — double glazing installed 2002-2021). When the Elmhurst +Summary PDF wraps the trailing "and 2021" into an adjacent table cell the +extractor joins away, the surfaced label truncates to "Double between 2002" +(the same artifact already handled for "Triple post or during"). Before this +was mapped the truncated form raised `UnmappedElmhurstLabel`, blocking the +whole Summary (surfaced on the simulated-case-46 multi-attribute worksheet). +""" + +from datatypes.epc.domain.mapper import ( + _elmhurst_glazing_type_code, # pyright: ignore[reportPrivateUsage] +) + + +def test_truncated_double_between_2002_maps_to_code_3() -> None: + # Arrange — the year-truncated form of "Double between 2002 and 2021". + + # Act + code = _elmhurst_glazing_type_code("Double between 2002") + full = _elmhurst_glazing_type_code("Double between 2002 and 2021") + + # Assert — both resolve to SAP 10.2 Table 24 code 3 (DG 2002-2021). + assert code == 3 + assert full == 3