Home / Function/ test_aindex_delete_full_recovery_after_deletion_failure() — langchain Function Reference

test_aindex_delete_full_recovery_after_deletion_failure() — langchain Function Reference

Architecture documentation for the test_aindex_delete_full_recovery_after_deletion_failure() function in test_indexing.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  336335fa_024f_4e2e_30ac_9a898d07a0fd["test_aindex_delete_full_recovery_after_deletion_failure()"]
  a9fb4c74_0865_0941_ade3_563a79762cee["test_indexing.py"]
  336335fa_024f_4e2e_30ac_9a898d07a0fd -->|defined in| a9fb4c74_0865_0941_ade3_563a79762cee
  style 336335fa_024f_4e2e_30ac_9a898d07a0fd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/indexing/test_indexing.py lines 469–567

async def test_aindex_delete_full_recovery_after_deletion_failure(
    arecord_manager: InMemoryRecordManager, 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(
        arecord_manager,
        "get_time",
        return_value=datetime(2021, 1, 1, tzinfo=timezone.utc).timestamp(),
    ):
        assert await aindex(
            loader,
            arecord_manager,
            vector_store,
            cleanup="full",
            key_encoder="sha256",
        ) == {
            "num_added": 2,
            "num_deleted": 0,
            "num_skipped": 0,
            "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(
            arecord_manager,
            "get_time",
            return_value=datetime(2021, 1, 2, tzinfo=timezone.utc).timestamp(),
        ),
        patch.object(vector_store, "adelete", return_value=False),
        pytest.raises(IndexingException),
    ):
        indexing_result = await aindex(
            loader,
            arecord_manager,
            vector_store,
            cleanup="full",
            key_encoder="sha256",
        )

    # At this point, there should be 3 records in both the record manager
    # and the vector store
    doc_texts = {
        # Ignoring type since doc should be in the store and not a None
        vector_store.get_by_ids([uid])[0].page_content
        for uid in vector_store.store
    }
    assert doc_texts == {
        "This is a test document.",
        "mutated document 1",
        "This is another document.",
    }

    with patch.object(
        arecord_manager,
        "get_time",
        return_value=datetime(2021, 1, 3, tzinfo=timezone.utc).timestamp(),
    ):
        indexing_result = await aindex(
            loader,

Domain

Subdomains

Frequently Asked Questions

What does test_aindex_delete_full_recovery_after_deletion_failure() do?
test_aindex_delete_full_recovery_after_deletion_failure() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/indexing/test_indexing.py.
Where is test_aindex_delete_full_recovery_after_deletion_failure() defined?
test_aindex_delete_full_recovery_after_deletion_failure() is defined in libs/core/tests/unit_tests/indexing/test_indexing.py at line 469.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free