Home / Function/ test_upsert_some_ids() — langchain Function Reference

test_upsert_some_ids() — langchain Function Reference

Architecture documentation for the test_upsert_some_ids() function in indexer.py from the langchain codebase.

Function python LangChainCore Runnables calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  eb110bf4_53df_a3eb_901c_b50b5867670d["test_upsert_some_ids()"]
  67ebaa9c_263d_69d9_3a75_de0b0ac61588["DocumentIndexerTestSuite"]
  eb110bf4_53df_a3eb_901c_b50b5867670d -->|defined in| 67ebaa9c_263d_69d9_3a75_de0b0ac61588
  702fc239_c154_daa4_0737_20991e0f6c0e["test_upsert_some_ids()"]
  702fc239_c154_daa4_0737_20991e0f6c0e -->|calls| eb110bf4_53df_a3eb_901c_b50b5867670d
  702fc239_c154_daa4_0737_20991e0f6c0e["test_upsert_some_ids()"]
  eb110bf4_53df_a3eb_901c_b50b5867670d -->|calls| 702fc239_c154_daa4_0737_20991e0f6c0e
  style eb110bf4_53df_a3eb_901c_b50b5867670d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/integration_tests/indexer.py lines 67–91

    def test_upsert_some_ids(self, index: DocumentIndex) -> None:
        """Test an upsert where some docs have IDs and some don't."""
        foo_uuid = str(uuid.UUID(int=7))
        documents = [
            Document(id=foo_uuid, page_content="foo", metadata={"id": 1}),
            Document(page_content="bar", metadata={"id": 2}),
        ]
        response = index.upsert(documents)
        ids = response["succeeded"]
        other_id = next(iter(set(ids) - {foo_uuid}))
        assert response["failed"] == []
        assert foo_uuid in ids
        # Ordering is not guaranteed, so we use a set.
        documents = index.get(ids)
        first_doc = documents[0]
        if first_doc.id == foo_uuid:
            assert documents == [
                Document(page_content="foo", metadata={"id": 1}, id=foo_uuid),
                Document(page_content="bar", metadata={"id": 2}, id=other_id),
            ]
        else:
            assert documents == [
                Document(page_content="bar", metadata={"id": 2}, id=other_id),
                Document(page_content="foo", metadata={"id": 1}, id=foo_uuid),
            ]

Domain

Subdomains

Frequently Asked Questions

What does test_upsert_some_ids() do?
test_upsert_some_ids() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/indexer.py.
Where is test_upsert_some_ids() defined?
test_upsert_some_ids() is defined in libs/standard-tests/langchain_tests/integration_tests/indexer.py at line 67.
What does test_upsert_some_ids() call?
test_upsert_some_ids() calls 1 function(s): test_upsert_some_ids.
What calls test_upsert_some_ids()?
test_upsert_some_ids() is called by 1 function(s): test_upsert_some_ids.

Analyze Your Own Codebase

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

Try Supermodel Free