test_default_from_documents() — langchain Function Reference
Architecture documentation for the test_default_from_documents() function in test_vectorstore.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 36b62e9f_dcf8_c27f_cb24_8cbddcbe9fd6["test_default_from_documents()"] 547b9326_0fd1_ea2c_f15c_82026f35f74c["test_vectorstore.py"] 36b62e9f_dcf8_c27f_cb24_8cbddcbe9fd6 -->|defined in| 547b9326_0fd1_ea2c_f15c_82026f35f74c cb881d61_c433_1fa7_9b56_681f781555e5["get_by_ids()"] 36b62e9f_dcf8_c27f_cb24_8cbddcbe9fd6 -->|calls| cb881d61_c433_1fa7_9b56_681f781555e5 style 36b62e9f_dcf8_c27f_cb24_8cbddcbe9fd6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/vectorstores/test_vectorstore.py lines 242–265
def test_default_from_documents(vs_class: type[VectorStore]) -> None:
embeddings = FakeEmbeddings(size=1)
store = vs_class.from_documents(
[Document(id="1", page_content="hello", metadata={"foo": "bar"})], embeddings
)
assert store.get_by_ids(["1"]) == [
Document(id="1", page_content="hello", metadata={"foo": "bar"})
]
# from_documents with IDs in args
store = vs_class.from_documents(
[Document(page_content="hello", metadata={"foo": "bar"})], embeddings, ids=["1"]
)
assert store.get_by_ids(["1"]) == [
Document(id="1", page_content="hello", metadata={"foo": "bar"})
]
# Test from_documents with id specified in both document and ids
original_document = Document(id="7", page_content="baz")
store = vs_class.from_documents([original_document], embeddings, ids=["6"])
assert original_document.id == "7" # original document should not be modified
assert store.get_by_ids(["6"]) == [Document(id="6", page_content="baz")]
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does test_default_from_documents() do?
test_default_from_documents() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/vectorstores/test_vectorstore.py.
Where is test_default_from_documents() defined?
test_default_from_documents() is defined in libs/core/tests/unit_tests/vectorstores/test_vectorstore.py at line 242.
What does test_default_from_documents() call?
test_default_from_documents() calls 1 function(s): get_by_ids.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free