-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add DocumentWriter v2 #5435
Conversation
Pull Request Test Coverage Report for Build 5876944024
💛 - Coveralls |
|
||
|
||
@pytest.mark.integration | ||
def test_writer_adds_documents_to_store(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this test is not necessary as we're not even testing the DocumentWriter
really.
If we want to test that the component does what we're supposed to do we just need to verify that self.store.write_documents
is called when executing run
.
The actual writing is not this component's responsibility.
Something like this should work.
@pytest.mark.unit
def test_document_writer_run():
mock_store = store(MagicMock)()
writer = DocumentWriter()
writer.store = mock_store
data = writer.input(documents=[Document(content="This is the text of a document.")])
writer.run(data=data)
assert mock_store.write_documents.called```
Co-authored-by: Daria Fokina <[email protected]>
832e4b5
to
04a9dc7
Compare
04a9dc7
to
7c884df
Compare
* add draft of WriteToStore and basic test * add DocumentWriter implementation * draft unit and integration tests * add release note * mock Store in unit tests * pylint * Update haystack/preview/components/writers/document_writer.py Co-authored-by: Daria Fokina <[email protected]> * Remove unnecessary test * Rework DocumentWriter to support new Component I/O definition --------- Co-authored-by: Daria Fokina <[email protected]> Co-authored-by: Silvano Cerza <[email protected]>
Related Issues
DocumentWriter
(v2) #5339Proposed Changes:
This PR implements the new DocumentWriter component that can interact with all Stores and it adds two unit tests and one integration test.
How did you test it?
new unit tests, new integration test
Notes for the reviewer
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.