Leave a uniform or unparseable glazing description to the LLM classifier 🟩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-01 11:05:10 +00:00
parent 38448e47cc
commit 4e4a2d21c4

View file

@ -1,5 +1,7 @@
from __future__ import annotations
import pytest
from domain.epc.property_overrides.glazing_type import GlazingType
from domain.epc.property_overrides.glazing_mix_guard import glazing_mix_guard
@ -14,3 +16,24 @@ def test_a_genuine_percentage_mix_classifies_as_mixed() -> None:
# Assert — a mix defers to the cert's per-window glazing, not a whole-dwelling
# type.
assert result is GlazingType.MIXED
@pytest.mark.parametrize(
"description",
[
"100% double glazing 2002 or later", # uniform — one type
"96% double glazing 2002 or later, 4% single glazing", # >= 90% -> uniform
"80% double glazing 2002 or later, 20% double glazing pre-2002", # same base type
"some double glazing and a bit of single", # unparseable — no percentages
"",
],
)
def test_uniform_or_unparseable_glazing_defers_to_the_llm(description: str) -> None:
# The guard only claims a genuine percentage mix; a uniform assertion (applied
# as that type) or a varied phrasing is left for the LLM classifier.
# Act
result = glazing_mix_guard(description)
# Assert
assert result is None