mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
effective-lodged-divergence is silent for implausible lodged scores (< 13) 🟥
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ee9a1c4d90
commit
cf097afc00
1 changed files with 48 additions and 0 deletions
48
tests/scripts/test_audit_anomalies.py
Normal file
48
tests/scripts/test_audit_anomalies.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
from typing import Optional
|
||||
|
||||
import pytest
|
||||
|
||||
from scripts.audit.anomalies import (
|
||||
PropertyAudit,
|
||||
_effective_lodged_divergence,
|
||||
)
|
||||
|
||||
|
||||
def _make_audit(
|
||||
*,
|
||||
lodged_sap: Optional[float],
|
||||
effective_sap: Optional[float],
|
||||
rebaseline_reason: str = "both",
|
||||
) -> PropertyAudit:
|
||||
return PropertyAudit(
|
||||
property_id=1,
|
||||
uprn=None,
|
||||
portfolio_id=796,
|
||||
scenario_id=None,
|
||||
scenario_goal_band=None,
|
||||
lodged_sap=lodged_sap,
|
||||
lodged_band=None,
|
||||
effective_sap=effective_sap,
|
||||
effective_band=None,
|
||||
rebaseline_reason=rebaseline_reason,
|
||||
post_sap=None,
|
||||
post_band=None,
|
||||
cost_of_works=None,
|
||||
energy_bill_savings=None,
|
||||
energy_consumption_savings=None,
|
||||
solar_sap_points=None,
|
||||
solar_bill_savings=None,
|
||||
n_measures=0,
|
||||
)
|
||||
|
||||
|
||||
class TestEffectiveLodgedDivergence:
|
||||
def test_silent_when_lodged_sap_below_floor(self) -> None:
|
||||
# Arrange — Class C exemplar: lodged=1, effective=76 (gap +75, but lodged is implausible upstream data)
|
||||
audit = _make_audit(lodged_sap=1.0, effective_sap=76.0)
|
||||
|
||||
# Act
|
||||
result = _effective_lodged_divergence(audit)
|
||||
|
||||
# Assert
|
||||
assert result is None
|
||||
Loading…
Add table
Reference in a new issue