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
  702fc239_c154_daa4_0737_20991e0f6c0e["test_upsert_some_ids()"]
  091c1ddc_0019_3806_d313_14532add9618["AsyncDocumentIndexTestSuite"]
  702fc239_c154_daa4_0737_20991e0f6c0e -->|defined in| 091c1ddc_0019_3806_d313_14532add9618
  eb110bf4_53df_a3eb_901c_b50b5867670d["test_upsert_some_ids()"]
  eb110bf4_53df_a3eb_901c_b50b5867670d -->|calls| 702fc239_c154_daa4_0737_20991e0f6c0e
  eb110bf4_53df_a3eb_901c_b50b5867670d["test_upsert_some_ids()"]
  702fc239_c154_daa4_0737_20991e0f6c0e -->|calls| eb110bf4_53df_a3eb_901c_b50b5867670d
  style 702fc239_c154_daa4_0737_20991e0f6c0e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/standard-tests/langchain_tests/integration_tests/indexer.py lines 257–281

    async 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 = await index.aupsert(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 = await index.aget(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 257.
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