From 845062ce2d6459866a6dfe89d72a315fd36b7a03 Mon Sep 17 00:00:00 2001 From: Tanay Soni Date: Wed, 22 Jan 2020 16:08:52 +0100 Subject: [PATCH] Fix tests --- test/test_db.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/test/test_db.py b/test/test_db.py index 24bbd5fcf..f6d67cd1a 100644 --- a/test/test_db.py +++ b/test/test_db.py @@ -1,13 +1,10 @@ -from haystack.indexing.io import write_documents_to_db, fetch_archive_from_http -from haystack.database.orm import Document +from haystack.database.sql import SQLDocumentStore +from haystack.indexing.io import write_documents_to_db 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).order_by(Document.text).all() + sql_datastore = SQLDocumentStore() + write_documents_to_db(datastore=sql_datastore, document_dir="samples/docs") + documents = sql_datastore.get_all_documents() 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.' + assert documents[0]["text"] == 'A Doc specifically talking about haystack.\nHaystack can be used to scale QA models to large document collections.'