mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-04 20:46:45 +00:00
FAISS and embedding support (#48)
also adds embeddings and an in memory docstore
This commit is contained in:
21
tests/unit_tests/docstore/test_inmemory.py
Normal file
21
tests/unit_tests/docstore/test_inmemory.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Test in memory docstore."""
|
||||
|
||||
from langchain.docstore.document import Document
|
||||
from langchain.docstore.in_memory import InMemoryDocstore
|
||||
|
||||
|
||||
def test_document_found() -> None:
|
||||
"""Test document found."""
|
||||
_dict = {"foo": Document(page_content="bar")}
|
||||
docstore = InMemoryDocstore(_dict)
|
||||
output = docstore.search("foo")
|
||||
assert isinstance(output, Document)
|
||||
assert output.page_content == "bar"
|
||||
|
||||
|
||||
def test_document_not_found() -> None:
|
||||
"""Test when document is not found."""
|
||||
_dict = {"foo": Document(page_content="bar")}
|
||||
docstore = InMemoryDocstore(_dict)
|
||||
output = docstore.search("bar")
|
||||
assert output == "ID bar not found."
|
Reference in New Issue
Block a user