test_index_simple_delete_full() — langchain Function Reference
Architecture documentation for the test_index_simple_delete_full() function in test_indexing.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a64ea393_96fa_61c0_7b7a_554e10407e78["test_index_simple_delete_full()"] 9bc4e8b6_769a_ae11_3fc1_309cb678c248["test_indexing.py"] a64ea393_96fa_61c0_7b7a_554e10407e78 -->|defined in| 9bc4e8b6_769a_ae11_3fc1_309cb678c248 style a64ea393_96fa_61c0_7b7a_554e10407e78 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/indexes/test_indexing.py lines 248–329
def test_index_simple_delete_full(
record_manager: SQLRecordManager,
vector_store: InMemoryVectorStore,
) -> None:
"""Indexing some content to confirm it gets added only once."""
loader = ToyLoader(
documents=[
Document(
page_content="This is a test document.",
),
Document(
page_content="This is another document.",
),
],
)
with patch.object(
record_manager,
"get_time",
return_value=_JANUARY_FIRST,
):
assert index(loader, record_manager, vector_store, cleanup="full") == {
"num_added": 2,
"num_deleted": 0,
"num_skipped": 0,
"num_updated": 0,
}
with patch.object(
record_manager,
"get_time",
return_value=_JANUARY_FIRST,
):
assert index(loader, record_manager, vector_store, cleanup="full") == {
"num_added": 0,
"num_deleted": 0,
"num_skipped": 2,
"num_updated": 0,
}
loader = ToyLoader(
documents=[
Document(
page_content="mutated document 1",
),
Document(
page_content="This is another document.", # <-- Same as original
),
],
)
with patch.object(
record_manager,
"get_time",
return_value=_JANUARY_SECOND,
):
assert index(loader, record_manager, vector_store, cleanup="full") == {
"num_added": 1,
"num_deleted": 1,
"num_skipped": 1,
"num_updated": 0,
}
doc_texts = {
# Ignoring type since doc should be in the store and not a None
vector_store.store.get(uid).page_content # type: ignore[union-attr]
for uid in vector_store.store
}
assert doc_texts == {"mutated document 1", "This is another document."}
# Attempt to index again verify that nothing changes
with patch.object(
record_manager,
"get_time",
return_value=_JANUARY_SECOND,
):
assert index(loader, record_manager, vector_store, cleanup="full") == {
"num_added": 0,
"num_deleted": 0,
"num_skipped": 2,
"num_updated": 0,
Domain
Subdomains
Source
Frequently Asked Questions
What does test_index_simple_delete_full() do?
test_index_simple_delete_full() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/indexes/test_indexing.py.
Where is test_index_simple_delete_full() defined?
test_index_simple_delete_full() is defined in libs/langchain/tests/unit_tests/indexes/test_indexing.py at line 248.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free