diff --git a/test/samples/docs/doc_1.txt b/test/samples/docs/doc_1.txt new file mode 100644 index 000000000..13d7350d4 --- /dev/null +++ b/test/samples/docs/doc_1.txt @@ -0,0 +1,2 @@ +Some text for testing. +Two lines in here. \ No newline at end of file diff --git a/test/samples/docs/doc_2.txt b/test/samples/docs/doc_2.txt new file mode 100644 index 000000000..a3f276dcb --- /dev/null +++ b/test/samples/docs/doc_2.txt @@ -0,0 +1,2 @@ +A Doc specifically talking about haystack. +Haystack can be used to scale QA models to large document collections. \ No newline at end of file diff --git a/test/test_db.py b/test/test_db.py new file mode 100644 index 000000000..6451554a5 --- /dev/null +++ b/test/test_db.py @@ -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) \ No newline at end of file