mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-19 17:03:02 +00:00
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from domain.epc.property_overrides.main_heating_guard import main_heating_guard
|
|
from domain.epc.property_overrides.main_heating_system_type import (
|
|
MainHeatingSystemType,
|
|
)
|
|
|
|
|
|
def test_guard_resolves_high_heat_retention_storage() -> None:
|
|
# Arrange — the structured phrasing the LLM funnelled into "old storage" (401).
|
|
description = "Electric Storage Systems: High heat retention storage heaters"
|
|
|
|
# Act
|
|
result = main_heating_guard(description)
|
|
|
|
# Assert — HHRSH has its own archetype (SAP 409), never old storage (ADR-0044).
|
|
assert result is MainHeatingSystemType.ELECTRIC_STORAGE_HIGH_HEAT_RETENTION
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"description",
|
|
[
|
|
# Other storage subtypes the LLM already classifies correctly — the guard
|
|
# only rescues the HHRSH gap, leaving the rest to the fallback classifier.
|
|
"Electric Storage Systems: Old (large volume) storage heaters",
|
|
"Electric Storage Systems: Modern (slimline) storage heaters",
|
|
"Electric Storage Systems: Fan storage heaters",
|
|
# Unrelated / varied phrasings are the LLM's job.
|
|
"Gas boiler",
|
|
"",
|
|
],
|
|
)
|
|
def test_guard_defers_non_hhrsh_descriptions_to_the_llm(description: str) -> None:
|
|
# Act
|
|
result = main_heating_guard(description)
|
|
|
|
# Assert
|
|
assert result is None
|