mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 13:07:58 +00:00
Enable InMemoryDocstore to be constructed without providing a dict (#6976)
- Description: Allow `InMemoryDocstore` to be created without passing a dict to the constructor; the constructor can create a dict at runtime if one isn't provided. - Tag maintainer: @dev2049
This commit is contained in:
@@ -54,3 +54,12 @@ def test_adding_document_already_exists() -> None:
|
||||
bar_output = docstore.search("foo")
|
||||
assert isinstance(bar_output, Document)
|
||||
assert bar_output.page_content == "bar"
|
||||
|
||||
|
||||
def test_default_dict_value_in_constructor() -> None:
|
||||
"""Test proper functioning if no _dict is provided to the constructor."""
|
||||
docstore = InMemoryDocstore()
|
||||
docstore.add({"foo": Document(page_content="bar")})
|
||||
output = docstore.search("foo")
|
||||
assert isinstance(output, Document)
|
||||
assert output.page_content == "bar"
|
||||
|
Reference in New Issue
Block a user