from __future__ import annotations import pytest from domain.epc.property_overrides.main_fuel_guard import main_fuel_guard from domain.epc.property_overrides.main_fuel_type import MainFuelType def test_guard_resolves_individual_wood_logs() -> None: # Arrange — the bug: with no individual wood-logs member, the LLM funnelled a # solid-fuel wood-logs dwelling into "biomass (community)" (inventing a # community heat network it isn't on). description = "Solid Fuel: Wood Logs" # Act result = main_fuel_guard(description) # Assert — an individual wood-logs fuel, never community biomass. assert result is MainFuelType.WOOD_LOGS @pytest.mark.parametrize( "description", [ # Fuels the LLM already classifies correctly — the guard only rescues the # wood-logs gap and leaves the rest to the fallback classifier. "Gas: Mains Gas", "Electricity: Electricity", "Oil and Liquid Fuels: Oil", # Dual fuel contains "wood" but not "wood log" — it has its own member (10) # and must not be stolen by the wood-logs rule. "Solid Fuel: Dual Fuel: Mineral and Wood", # Genuine community biomass keeps its community member. "Other Heat: Biomass (Community)", "", ], ) def test_guard_defers_other_fuels_to_the_llm(description: str) -> None: # Act result = main_fuel_guard(description) # Assert assert result is None