From 4e4a2d21c4d24bd58dd37c61481c39eb73e778b7 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 1 Jul 2026 11:05:10 +0000 Subject: [PATCH] =?UTF-8?q?Leave=20a=20uniform=20or=20unparseable=20glazin?= =?UTF-8?q?g=20description=20to=20the=20LLM=20classifier=20=F0=9F=9F=A9?= 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_glazing_mix_guard.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/domain/epc/test_glazing_mix_guard.py b/tests/domain/epc/test_glazing_mix_guard.py index 973b96b6a..04e351cd3 100644 --- a/tests/domain/epc/test_glazing_mix_guard.py +++ b/tests/domain/epc/test_glazing_mix_guard.py @@ -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