feat(gui): confirmation explicite avant anonymisation regex-only (NER off)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
31
tests/unit/test_gui_v6_ner_confirm.py
Normal file
31
tests/unit/test_gui_v6_ner_confirm.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Confirmation avant de désactiver le NER (regex-only) — outil médical.
|
||||
|
||||
Pur : la décision est isolée dans ``confirm_ner_disable(asker)`` ; ``asker`` est
|
||||
injecté (pas de messagebox réel, pas de display).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from gui_v6.tabs.tab_config import NER_DISABLE_WARNING, confirm_ner_disable
|
||||
|
||||
|
||||
def test_confirm_true_when_user_accepts():
|
||||
assert confirm_ner_disable(lambda: True) is True
|
||||
|
||||
|
||||
def test_confirm_false_when_user_declines():
|
||||
assert confirm_ner_disable(lambda: False) is False
|
||||
|
||||
|
||||
def test_confirm_false_when_asker_raises():
|
||||
def boom():
|
||||
raise RuntimeError("Tk indisponible")
|
||||
# Sens sûr : une erreur de dialogue ne désactive jamais le NER.
|
||||
assert confirm_ner_disable(boom) is False
|
||||
|
||||
|
||||
def test_warning_text_is_explicit_for_medical_use():
|
||||
txt = NER_DISABLE_WARNING.lower()
|
||||
# L'avertissement DOIT nommer la dégradation : règles/regex + risque noms.
|
||||
assert "règles" in txt or "regex" in txt
|
||||
assert "nom" in txt
|
||||
assert "recommand" in txt # « fortement recommandé »
|
||||
Reference in New Issue
Block a user