test: Check only top answer in extractive QA e2e test (#6614)

This commit is contained in:
Julian Risch 2023-12-22 11:11:24 +01:00 committed by GitHub
parent 8469c7f702
commit d90f95be2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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