ESP-IDF CI / Host Tests (Unity) (push) Successful in 1m8s
CI / firmware-native (push) Successful in 2m57s
Rust Protection Tests / Cargo test (host) (push) Failing after 3m21s
ESP-IDF CI / ESP-IDF Build (v5.4) (push) Failing after 6m55s
ESP-IDF CI / Memory Budget Gate (push) Has been skipped
qa-cicd-environments / qa-kxkm-s3-build (push) Successful in 8m53s
qa-cicd-environments / qa-sim-host (push) Successful in 2m2s
qa-cicd-environments / qa-kxkm-s3-memory-budget (push) Successful in 11m17s
Context: the project archive (KXKM_Batterie_Parallelator-main) had no git history locally; a fresh repository is needed to host it on git.saillant.cc (electron/KXKM_Batterie_Parallelator). Approach: initialize a new repo on branch main, stage the archive content, and harden .gitignore before the first commit. Changes: - Import the full project tree: firmware/, firmware-idf/, firmware-rs/, iosApp/, kxkm-bmu-app/, kxkm-api/, hardware/, docs/, specs/, scripts/, models/, tests/ - Keep project dotfiles tracked despite the trailing '.*' ignore rule: .github/, .claude/, .superpowers/, .gitattributes, .markdownlint.json - Extend .gitignore: firmware/src/credentials.h (local secrets, template kept), kxkm-bmu-app/**/build/ (66 MB compiled iOS framework), .remember/ (session data) Impact: the project can now be maintained on the self-hosted Gitea forge with a clean, secret-free initial history.
56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
"""Unit tests for severity extraction from diagnostic text."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "services" / "soh-llm"))
|
|
|
|
from prompt_template import extract_severity
|
|
|
|
|
|
class TestExplicitTags:
|
|
def test_info_tag(self):
|
|
assert extract_severity("Batterie en bon état. [INFO]") == "info"
|
|
|
|
def test_warning_tag(self):
|
|
assert extract_severity("Dégradation lente observée. [WARNING]") == "warning"
|
|
|
|
def test_critical_tag(self):
|
|
assert extract_severity("[CRITICAL] Remplacer la batterie.") == "critical"
|
|
|
|
def test_tag_priority_critical_over_warning(self):
|
|
assert extract_severity("[CRITICAL] Attention [WARNING]") == "critical"
|
|
|
|
def test_tag_priority_warning_over_info(self):
|
|
assert extract_severity("[WARNING] [INFO]") == "warning"
|
|
|
|
def test_case_insensitive(self):
|
|
assert extract_severity("OK. [info]") == "info"
|
|
assert extract_severity("Bad. [Critical]") == "critical"
|
|
|
|
|
|
class TestKeywordFallback:
|
|
def test_critical_keywords(self):
|
|
texts = [
|
|
"État critique, la batterie doit être remplacée immédiatement.",
|
|
"Situation urgente, intervention requise.",
|
|
"Batterie en fin de vie, hors service.",
|
|
]
|
|
for t in texts:
|
|
assert extract_severity(t) == "critical", f"Failed for: {t}"
|
|
|
|
def test_warning_keywords(self):
|
|
texts = [
|
|
"Attention, la résistance interne augmente. Surveiller l'évolution.",
|
|
"Dégradation progressive, planifier le remplacement.",
|
|
"Vigilance requise sur la tendance R_int.",
|
|
]
|
|
for t in texts:
|
|
assert extract_severity(t) == "warning", f"Failed for: {t}"
|
|
|
|
def test_default_info(self):
|
|
assert extract_severity("Batterie en bon état, aucun problème détecté.") == "info"
|
|
|
|
def test_empty_string(self):
|
|
assert extract_severity("") == "info"
|