From b0aa83f664c1495bdd42c4fdab7647d23961826d Mon Sep 17 00:00:00 2001 From: dom Date: Sun, 8 Mar 2026 14:35:39 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20adapter=20tests=20RAG=20=C3=A0=20la=20no?= =?UTF-8?q?uvelle=20parall=C3=A9lisation=20(enrich=5Fdp=5Fonly=20+=20enric?= =?UTF-8?q?h=5Fdas=5Fand=5Factes)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/test_rag.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/test_rag.py b/tests/test_rag.py index b4b70d9..3022d32 100644 --- a/tests/test_rag.py +++ b/tests/test_rag.py @@ -116,7 +116,7 @@ class TestExtractMedicalInfoRAGFlag: assert dossier.diagnostic_principal.justification is None 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 parsed = { @@ -127,9 +127,13 @@ class TestExtractMedicalInfoRAGFlag: } 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) - 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): """Par défaut, use_rag=False.""" @@ -143,9 +147,11 @@ class TestExtractMedicalInfoRAGFlag: } 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) - mock_enrich.assert_not_called() + mock_dp.assert_not_called() + mock_das.assert_not_called() class TestChunkingCIM10: