Skip to content

Commit 06fdad2

Browse files
authored
fix test_pipeline_with_documents (#505)
make a copy to ensure original documents are not modified in non-inplace mode. background: This is a regression introduced in #498, where we changed the scope of the `documents` fixture to `module`.
1 parent 9c956d0 commit 06fdad2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/test_pipeline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ def test_pipeline_with_document(documents, prepared_taskmodule, mock_model, inpl
109109
@pytest.mark.slow
110110
@pytest.mark.parametrize("inplace", [False, True])
111111
def test_pipeline_with_documents(documents, prepared_taskmodule, mock_model, inplace):
112+
# make a copy to ensure original documents are not modified in non-inplace mode
113+
documents = [doc.copy() for doc in documents]
112114
pipeline = Pipeline(model=mock_model, taskmodule=prepared_taskmodule, device=-1)
113115

114116
returned_documents = pipeline(documents, inplace=inplace)

0 commit comments

Comments
 (0)