mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
13 lines
457 B
Python
13 lines
457 B
Python
|
from langchain.docstore.arbitrary_fn import DocstoreFn
|
||
|
from langchain.schema import Document
|
||
|
|
||
|
|
||
|
def test_document_found() -> None:
|
||
|
# we use a dict here for simiplicity, but this could be any function
|
||
|
# including a remote lookup
|
||
|
dummy_dict = {"foo": Document(page_content="bar")}
|
||
|
docstore = DocstoreFn(lambda x: dummy_dict[x])
|
||
|
output = docstore.search("foo")
|
||
|
assert isinstance(output, Document)
|
||
|
assert output.page_content == "bar"
|