Home / Function/ test_bad_parent_ids() — langchain Function Reference

test_bad_parent_ids() — langchain Function Reference

Architecture documentation for the test_bad_parent_ids() function in test_runnable_events_v2.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  811af5ba_9b06_c790_3f40_25514b978311["test_bad_parent_ids()"]
  33c02978_2077_5819_7048_bc2a81e80625["test_runnable_events_v2.py"]
  811af5ba_9b06_c790_3f40_25514b978311 -->|defined in| 33c02978_2077_5819_7048_bc2a81e80625
  716d2a5e_dc8e_3cae_e044_b56b06bee655["_collect_events()"]
  811af5ba_9b06_c790_3f40_25514b978311 -->|calls| 716d2a5e_dc8e_3cae_e044_b56b06bee655
  style 811af5ba_9b06_c790_3f40_25514b978311 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py lines 2342–2375

async def test_bad_parent_ids() -> None:
    """Test handling of situation where a run id is duplicated in the run tree."""

    @RunnableLambda
    async def child(x: str) -> str:
        return x

    @RunnableLambda
    async def parent(x: str, config: RunnableConfig) -> str:
        config["run_id"] = uuid.UUID(int=7)
        return await child.ainvoke(x, config)

    bond = uuid.UUID(int=7)
    events = await _collect_events(
        parent.astream_events("hello", {"run_id": bond}, version="v2"),
        with_nulled_ids=False,
    )
    # Includes only a partial list of events since the run ID gets duplicated
    # between parent and child run ID and the callback handler throws an exception.
    # The exception does not get bubbled up to the user.
    _assert_events_equal_allow_superset_metadata(
        events,
        [
            {
                "data": {"input": "hello"},
                "event": "on_chain_start",
                "metadata": {},
                "name": "parent",
                "parent_ids": [],
                "run_id": "00000000-0000-0000-0000-000000000007",
                "tags": [],
            }
        ],
    )

Domain

Subdomains

Frequently Asked Questions

What does test_bad_parent_ids() do?
test_bad_parent_ids() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py.
Where is test_bad_parent_ids() defined?
test_bad_parent_ids() is defined in libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py at line 2342.
What does test_bad_parent_ids() call?
test_bad_parent_ids() calls 1 function(s): _collect_events.

Analyze Your Own Codebase

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

Try Supermodel Free