Home / Function/ test_index_simple_delete_scoped_full() — langchain Function Reference

test_index_simple_delete_scoped_full() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/indexing/test_indexing.py lines 670–793

def test_index_simple_delete_scoped_full(
    record_manager: InMemoryRecordManager, vector_store: InMemoryVectorStore
) -> None:
    """Test Indexing with scoped_full strategy."""
    loader = ToyLoader(
        documents=[
            Document(
                page_content="This is a test document.",
                metadata={"source": "1"},
            ),
            Document(
                page_content="This is another document.",
                metadata={"source": "1"},
            ),
            Document(
                page_content="This is yet another document.",
                metadata={"source": "1"},
            ),
            Document(
                page_content="This is a test document from another source.",
                metadata={"source": "2"},
            ),
        ]
    )

    with patch.object(
        record_manager,
        "get_time",
        return_value=datetime(2021, 1, 1, tzinfo=timezone.utc).timestamp(),
    ):
        assert index(
            loader,
            record_manager,
            vector_store,
            cleanup="scoped_full",
            source_id_key="source",
            key_encoder="sha256",
        ) == {
            "num_added": 4,
            "num_deleted": 0,
            "num_skipped": 0,
            "num_updated": 0,
        }

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

    loader = ToyLoader(
        documents=[
            Document(
                page_content="mutated document 1",
                metadata={"source": "1"},
            ),
            Document(
                page_content="This is another document.",  # <-- Same as original
                metadata={"source": "1"},
            ),
        ]
    )

    with patch.object(
        record_manager,
        "get_time",
        return_value=datetime(2021, 1, 3, tzinfo=timezone.utc).timestamp(),
    ):

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free