Home / Function/ test_aindex_into_document_index() — langchain Function Reference

test_aindex_into_document_index() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/indexing/test_indexing.py lines 2691–2758

async def test_aindex_into_document_index(
    arecord_manager: InMemoryRecordManager,
) -> None:
    """Get an in memory index."""
    document_index = InMemoryDocumentIndex()
    docs = [
        Document(
            page_content="This is a test document.",
            metadata={"source": "1"},
        ),
        Document(
            page_content="This is another document.",
            metadata={"source": "2"},
        ),
    ]

    assert await aindex(
        docs,
        arecord_manager,
        document_index,
        cleanup="full",
        key_encoder="sha256",
    ) == {
        "num_added": 2,
        "num_deleted": 0,
        "num_skipped": 0,
        "num_updated": 0,
    }

    assert await aindex(
        docs,
        arecord_manager,
        document_index,
        cleanup="full",
        key_encoder="sha256",
    ) == {
        "num_added": 0,
        "num_deleted": 0,
        "num_skipped": 2,
        "num_updated": 0,
    }

    assert await aindex(
        docs,
        arecord_manager,
        document_index,
        cleanup="full",
        force_update=True,
        key_encoder="sha256",
    ) == {
        "num_added": 0,
        "num_deleted": 0,
        "num_skipped": 0,
        "num_updated": 2,
    }

    assert await aindex(
        [],
        arecord_manager,
        document_index,
        cleanup="full",
        key_encoder="sha256",
    ) == {
        "num_added": 0,
        "num_deleted": 2,
        "num_skipped": 0,
        "num_updated": 0,
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free