Refine Telegram alert behavior
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app.services.alert_service import _classify_quadrant
|
||||
from app.services.alert_service import _classify_quadrant, _parse_quadrant_log_key, _quadrant_log_key
|
||||
|
||||
|
||||
# Quadrant ids: 1=① hot&brittle (regime low, warning high), 2=② transition
|
||||
@@ -43,3 +43,10 @@ def test_boundary_sitting_does_not_flip():
|
||||
# A point parked exactly on both dividers keeps whatever quadrant it had.
|
||||
for q in ("1", "2", "3", "4"):
|
||||
assert _classify_quadrant(40, 60, prev=q) == q
|
||||
|
||||
|
||||
def test_quadrant_log_key_keeps_previous_values():
|
||||
key = _quadrant_log_key("3", 32.4, 54.6)
|
||||
assert _parse_quadrant_log_key(key) == ("3", 32.4, 54.6)
|
||||
# Existing pre-value keys still parse so old installs do not need migration.
|
||||
assert _parse_quadrant_log_key("3") == ("3", None, None)
|
||||
|
||||
Reference in New Issue
Block a user