mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-27 06:58:35 +00:00
add test
This commit is contained in:
parent
84ce175afe
commit
7400abe327
2
test/samples/docs/doc_1.txt
Normal file
2
test/samples/docs/doc_1.txt
Normal file
@ -0,0 +1,2 @@
|
||||
Some text for testing.
|
||||
Two lines in here.
|
||||
2
test/samples/docs/doc_2.txt
Normal file
2
test/samples/docs/doc_2.txt
Normal file
@ -0,0 +1,2 @@
|
||||
A Doc specifically talking about haystack.
|
||||
Haystack can be used to scale QA models to large document collections.
|
||||
14
test/test_db.py
Normal file
14
test/test_db.py
Normal file
@ -0,0 +1,14 @@
|
||||
from haystack.indexing.io import write_documents_to_db, fetch_archive_from_http
|
||||
from haystack.database.orm import Document
|
||||
|
||||
|
||||
def test_db_write_read():
|
||||
from haystack.database import db
|
||||
db.drop_all()
|
||||
db.create_all()
|
||||
|
||||
write_documents_to_db(document_dir="samples/docs")
|
||||
documents = db.session.query(Document).all()
|
||||
assert len(documents) == 2
|
||||
assert documents[0].text == 'A Doc specifically talking about haystack.\nHaystack can be used to scale QA models to large document collections.'
|
||||
print(documents)
|
||||
Loading…
x
Reference in New Issue
Block a user