Recognise the pitched sloping-ceiling descriptions as roof types 🟥

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-23 13:23:37 +00:00
parent fc738fa843
commit b8e9431292

View file

@ -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