Home / Function/ test_invoke_with_exception_key() — langchain Function Reference

test_invoke_with_exception_key() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  af592282_6535_32ff_1a6c_4b92cf373f69["test_invoke_with_exception_key()"]
  d62d478e_a330_c328_7da4_58e88d780807["test_fallbacks.py"]
  af592282_6535_32ff_1a6c_4b92cf373f69 -->|defined in| d62d478e_a330_c328_7da4_58e88d780807
  b4df7c29_3d15_7d1f_4ec5_5bcda5d0c06a["_assert_potential_error()"]
  af592282_6535_32ff_1a6c_4b92cf373f69 -->|calls| b4df7c29_3d15_7d1f_4ec5_5bcda5d0c06a
  style af592282_6535_32ff_1a6c_4b92cf373f69 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_fallbacks.py lines 125–143

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

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

    runnable_with_double = runnable.with_fallbacks(
        [runnable, runnable], exception_key="exception"
    )
    actual = runnable_with_double.invoke({"text": "baz"})

    expected = "third"
    _assert_potential_error([actual], [expected])

Subdomains

Frequently Asked Questions

What does test_invoke_with_exception_key() do?
test_invoke_with_exception_key() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_fallbacks.py.
Where is test_invoke_with_exception_key() defined?
test_invoke_with_exception_key() is defined in libs/core/tests/unit_tests/runnables/test_fallbacks.py at line 125.
What does test_invoke_with_exception_key() call?
test_invoke_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