fix: adapter tests RAG à la nouvelle parallélisation (enrich_dp_only + enrich_das_and_actes)

Les agents d'optimisation ont splitté _enrich_with_rag en _enrich_dp_only
et _enrich_das_and_actes mais n'ont pas mis à jour les mocks dans test_rag.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dom
2026-03-08 14:35:39 +01:00
parent f94d8496cb
commit b0aa83f664

View File

@@ -116,7 +116,7 @@ class TestExtractMedicalInfoRAGFlag:
assert dossier.diagnostic_principal.justification is None assert dossier.diagnostic_principal.justification is None
def test_use_rag_true_calls_enrich(self): def test_use_rag_true_calls_enrich(self):
"""use_rag=True appelle _enrich_with_rag (mocké).""" """use_rag=True appelle _enrich_dp_only et _enrich_das_and_actes (mockés)."""
from src.medical.cim10_extractor import extract_medical_info from src.medical.cim10_extractor import extract_medical_info
parsed = { parsed = {
@@ -127,9 +127,13 @@ class TestExtractMedicalInfoRAGFlag:
} }
text = "Pancréatite aiguë biliaire.\nTTT de sortie :\nParacétamol\n\nDevenir : retour." text = "Pancréatite aiguë biliaire.\nTTT de sortie :\nParacétamol\n\nDevenir : retour."
with patch("src.medical.cim10_extractor._enrich_with_rag") as mock_enrich: with patch("src.medical.cim10_extractor._enrich_dp_only") as mock_dp, \
patch("src.medical.cim10_extractor._enrich_das_and_actes") as mock_das, \
patch("src.medical.cim10_extractor._extract_das_llm"), \
patch("src.medical.cim10_extractor._validate_justifications"):
dossier = extract_medical_info(parsed, text, use_rag=True) dossier = extract_medical_info(parsed, text, use_rag=True)
mock_enrich.assert_called_once_with(dossier) mock_dp.assert_called_once_with(dossier)
mock_das.assert_called_once_with(dossier)
def test_use_rag_default_false(self): def test_use_rag_default_false(self):
"""Par défaut, use_rag=False.""" """Par défaut, use_rag=False."""
@@ -143,9 +147,11 @@ class TestExtractMedicalInfoRAGFlag:
} }
text = "Test simple." text = "Test simple."
with patch("src.medical.cim10_extractor._enrich_with_rag") as mock_enrich: with patch("src.medical.cim10_extractor._enrich_dp_only") as mock_dp, \
patch("src.medical.cim10_extractor._enrich_das_and_actes") as mock_das:
extract_medical_info(parsed, text) extract_medical_info(parsed, text)
mock_enrich.assert_not_called() mock_dp.assert_not_called()
mock_das.assert_not_called()
class TestChunkingCIM10: class TestChunkingCIM10: