From b8e94312920e22e6535d0db6937b52fb4b30e120 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 23 Jul 2026 13:23:37 +0000 Subject: [PATCH] =?UTF-8?q?Recognise=20the=20pitched=20sloping-ceiling=20d?= =?UTF-8?q?escriptions=20as=20roof=20types=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/domain/epc/test_roof_type.py | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/domain/epc/test_roof_type.py diff --git a/tests/domain/epc/test_roof_type.py b/tests/domain/epc/test_roof_type.py new file mode 100644 index 000000000..0b0eacbfb --- /dev/null +++ b/tests/domain/epc/test_roof_type.py @@ -0,0 +1,46 @@ +"""Contract tests for the `RoofType` Landlord-Override taxonomy. + +The `Pitched, sloping ceiling, …` family is lock-step with the app-side +`RoofTypeValues` enum + Drizzle migration 0278 (assessment-model#449, ADR-0002 / +ADR-0066): the string values here are the shared contract and must match +byte-for-byte. The classifier resolves a reply value to a member via +`RoofType(value)` (`ChatGptColumnClassifier._to_category`), so "is this a +recognised roof type" is exactly the `RoofType(value)` construction below. +""" + +from __future__ import annotations + +import pytest + +from domain.epc.property_overrides.roof_type import RoofType + +# The pitched-sloping-ceiling family, byte-for-byte with assessment-model#449. +_SLOPING_CEILING_VALUES: list[str] = [ + "Pitched, sloping ceiling, as built", + "Pitched, sloping ceiling, 12 mm insulation", + "Pitched, sloping ceiling, 25 mm insulation", + "Pitched, sloping ceiling, 50 mm insulation", + "Pitched, sloping ceiling, 75 mm insulation", + "Pitched, sloping ceiling, 100 mm insulation", + "Pitched, sloping ceiling, 125 mm insulation", + "Pitched, sloping ceiling, 150 mm insulation", + "Pitched, sloping ceiling, 175 mm insulation", + "Pitched, sloping ceiling, 200 mm insulation", + "Pitched, sloping ceiling, 225 mm insulation", + "Pitched, sloping ceiling, 250 mm insulation", + "Pitched, sloping ceiling, 270 mm insulation", + "Pitched, sloping ceiling, 300 mm insulation", + "Pitched, sloping ceiling, 350 mm insulation", + "Pitched, sloping ceiling, 400 mm insulation", + "Pitched, sloping ceiling, 400+ mm insulation", +] + + +@pytest.mark.parametrize("value", _SLOPING_CEILING_VALUES) +def test_pitched_sloping_ceiling_string_is_a_recognised_roof_type(value: str) -> None: + # Act — the classifier resolves a canonical string through the enum + # constructor; a missing member raises ValueError (falls to UNKNOWN). + member = RoofType(value) + + # Assert — the canonical string round-trips as its own member value. + assert member.value == value