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