Home / Function/ test_ano_delete() — langchain Function Reference

test_ano_delete() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/indexing/test_indexing.py lines 1282–1369

async def test_ano_delete(
    arecord_manager: InMemoryRecordManager, vector_store: InMemoryVectorStore
) -> None:
    """Test indexing without a deletion strategy."""
    loader = ToyLoader(
        documents=[
            Document(
                page_content="This is a test document.",
                metadata={"source": "1"},
            ),
            Document(
                page_content="This is another document.",
                metadata={"source": "2"},
            ),
        ]
    )

    with patch.object(
        arecord_manager,
        "get_time",
        return_value=datetime(2021, 1, 2, tzinfo=timezone.utc).timestamp(),
    ):
        assert await aindex(
            loader,
            arecord_manager,
            vector_store,
            cleanup=None,
            source_id_key="source",
            key_encoder="sha256",
        ) == {
            "num_added": 2,
            "num_deleted": 0,
            "num_skipped": 0,
            "num_updated": 0,
        }

    # If we add the same content twice it should be skipped
    with patch.object(
        arecord_manager,
        "get_time",
        return_value=datetime(2021, 1, 2, tzinfo=timezone.utc).timestamp(),
    ):
        assert await aindex(
            loader,
            arecord_manager,
            vector_store,
            cleanup=None,
            source_id_key="source",
            key_encoder="sha256",
        ) == {
            "num_added": 0,
            "num_deleted": 0,
            "num_skipped": 2,
            "num_updated": 0,
        }

    loader = ToyLoader(
        documents=[
            Document(
                page_content="mutated content",
                metadata={"source": "1"},
            ),
            Document(
                page_content="This is another document.",
                metadata={"source": "2"},
            ),
        ]
    )

    # Should result in no updates or deletions!
    with patch.object(
        arecord_manager,
        "get_time",
        return_value=datetime(2021, 1, 2, tzinfo=timezone.utc).timestamp(),
    ):
        assert await aindex(
            loader,
            arecord_manager,
            vector_store,
            cleanup=None,
            source_id_key="source",

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free