From d90f95be2e9d212e655ef8407f740ffd1453892a Mon Sep 17 00:00:00 2001 From: Julian Risch Date: Fri, 22 Dec 2023 11:11:24 +0100 Subject: [PATCH] test: Check only top answer in extractive QA e2e test (#6614) --- e2e/pipelines/test_extractive_qa_pipeline.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/e2e/pipelines/test_extractive_qa_pipeline.py b/e2e/pipelines/test_extractive_qa_pipeline.py index 9a5e6f675..fd101c88b 100644 --- a/e2e/pipelines/test_extractive_qa_pipeline.py +++ b/e2e/pipelines/test_extractive_qa_pipeline.py @@ -61,6 +61,10 @@ def test_extractive_qa_pipeline(tmp_path): assert hasattr(answer, "document_offset") assert hasattr(answer, "document") - # the answer is extracted from the correct document - if answer.document is not None: - assert answer.document.id == doc.id + + # the top answer is extracted from the correct document + top_answer = extracted_answers[0] + if top_answer.document is not None: + if top_answer.document.id != doc.id: + print(top_answer.document.id, doc.id) + assert top_answer.document.id == doc.id