Home / Function/ test_ainvoke_with_exception_key() — langchain Function Reference

test_ainvoke_with_exception_key() — langchain Function Reference

Architecture documentation for the test_ainvoke_with_exception_key() function in test_fallbacks.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c6596647_d066_c491_76b7_b73cc6efcb79["test_ainvoke_with_exception_key()"]
  905e276b_98d0_eba1_e23b_8303081c1894["test_fallbacks.py"]
  c6596647_d066_c491_76b7_b73cc6efcb79 -->|defined in| 905e276b_98d0_eba1_e23b_8303081c1894
  5c492ab9_cef1_c59f_e628_70082fe29bb2["_assert_potential_error()"]
  c6596647_d066_c491_76b7_b73cc6efcb79 -->|calls| 5c492ab9_cef1_c59f_e628_70082fe29bb2
  style c6596647_d066_c491_76b7_b73cc6efcb79 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_fallbacks.py lines 146–163

async def test_ainvoke_with_exception_key() -> None:
    runnable = RunnableLambda(_runnable)
    runnable_with_single = runnable.with_fallbacks(
        [runnable], exception_key="exception"
    )
    with pytest.raises(ValueError, match="missing exception"):
        await runnable_with_single.ainvoke({"text": "baz"})

    actual = await runnable_with_single.ainvoke({"text": "bar"})
    expected = "second"
    _assert_potential_error([actual], [expected])

    runnable_with_double = runnable.with_fallbacks(
        [runnable, runnable], exception_key="exception"
    )
    actual = await runnable_with_double.ainvoke({"text": "baz"})
    expected = "third"
    _assert_potential_error([actual], [expected])

Domain

Subdomains

Frequently Asked Questions

What does test_ainvoke_with_exception_key() do?
test_ainvoke_with_exception_key() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_fallbacks.py.
Where is test_ainvoke_with_exception_key() defined?
test_ainvoke_with_exception_key() is defined in libs/core/tests/unit_tests/runnables/test_fallbacks.py at line 146.
What does test_ainvoke_with_exception_key() call?
test_ainvoke_with_exception_key() calls 1 function(s): _assert_potential_error.

Analyze Your Own Codebase

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

Try Supermodel Free