Home / Function/ test_deleting_documents() — langchain Function Reference

test_deleting_documents() — langchain Function Reference

Architecture documentation for the test_deleting_documents() function in vectorstores.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  af2e773a_b1e4_05d0_8c96_01b3fbd074a6["test_deleting_documents()"]
  6b7f515d_5b14_acff_3191_2493436e519d["VectorStoreIntegrationTests"]
  af2e773a_b1e4_05d0_8c96_01b3fbd074a6 -->|defined in| 6b7f515d_5b14_acff_3191_2493436e519d
  style af2e773a_b1e4_05d0_8c96_01b3fbd074a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/integration_tests/vectorstores.py lines 205–225

    def test_deleting_documents(self, vectorstore: VectorStore) -> None:
        """Test deleting documents from the `VectorStore`.

        ??? note "Troubleshooting"

            If this test fails, check that `add_documents` preserves identifiers
            passed in through `ids`, and that `delete` correctly removes
            documents.
        """
        if not self.has_sync:
            pytest.skip("Sync tests not supported.")

        documents = [
            Document(page_content="foo", metadata={"id": 1}),
            Document(page_content="bar", metadata={"id": 2}),
        ]
        ids = vectorstore.add_documents(documents, ids=["1", "2"])
        assert ids == ["1", "2"]
        vectorstore.delete(["1"])
        documents = vectorstore.similarity_search("foo", k=1)
        assert documents == [Document(page_content="bar", metadata={"id": 2}, id="2")]

Subdomains

Frequently Asked Questions

What does test_deleting_documents() do?
test_deleting_documents() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/vectorstores.py.
Where is test_deleting_documents() defined?
test_deleting_documents() is defined in libs/standard-tests/langchain_tests/integration_tests/vectorstores.py at line 205.

Analyze Your Own Codebase

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

Try Supermodel Free