Home / Function/ test_config_passthrough_nested() — langchain Function Reference

test_config_passthrough_nested() — langchain Function Reference

Architecture documentation for the test_config_passthrough_nested() function in test_configurable.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6cb9178d_495f_3728_55b0_a5cbd49bfc36["test_config_passthrough_nested()"]
  ec7909ee_ece0_2780_95cd_f0c5229fc46d["test_configurable.py"]
  6cb9178d_495f_3728_55b0_a5cbd49bfc36 -->|defined in| ec7909ee_ece0_2780_95cd_f0c5229fc46d
  52678a78_ef5f_195a_cb54_4c667a93774e["my_custom_function()"]
  6cb9178d_495f_3728_55b0_a5cbd49bfc36 -->|calls| 52678a78_ef5f_195a_cb54_4c667a93774e
  cd1de384_a13b_a91a_7bed_d86ffbf38e59["my_custom_function_w_config()"]
  6cb9178d_495f_3728_55b0_a5cbd49bfc36 -->|calls| cd1de384_a13b_a91a_7bed_d86ffbf38e59
  57238a2b_7053_1eb1_fdbb_3907bc4b5d51["my_custom_function_w_kw_config()"]
  6cb9178d_495f_3728_55b0_a5cbd49bfc36 -->|calls| 57238a2b_7053_1eb1_fdbb_3907bc4b5d51
  349d602b_d814_413d_7db5_ed1bfe947fb3["my_other_custom_function()"]
  6cb9178d_495f_3728_55b0_a5cbd49bfc36 -->|calls| 349d602b_d814_413d_7db5_ed1bfe947fb3
  b463d81f_e716_68d2_4720_9728d5bef9ad["my_other_custom_function_w_config()"]
  6cb9178d_495f_3728_55b0_a5cbd49bfc36 -->|calls| b463d81f_e716_68d2_4720_9728d5bef9ad
  style 6cb9178d_495f_3728_55b0_a5cbd49bfc36 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_configurable.py lines 163–273

def test_config_passthrough_nested() -> None:
    runnable = MyRunnable(my_property="a")
    configurable_runnable = runnable.configurable_fields(
        my_property=ConfigurableField(
            id="my_property",
            name="My property",
            description="The property to test",
        )
    ).configurable_alternatives(
        ConfigurableField(id="which", description="Which runnable to use"),
        other=MyOtherRunnable(my_other_property="c"),
    )
    # first one
    with pytest.raises(AttributeError):
        configurable_runnable.not_my_custom_function()  # type: ignore[attr-defined]
    assert configurable_runnable.my_custom_function() == "a"  # type: ignore[attr-defined]
    assert (
        configurable_runnable.my_custom_function_w_config(  # type: ignore[attr-defined]
            {"configurable": {"my_property": "b"}}
        )
        == "b"
    )
    assert (
        configurable_runnable.my_custom_function_w_config(  # type: ignore[attr-defined]
            config={"configurable": {"my_property": "b"}}
        )
        == "b"
    )
    assert (
        configurable_runnable.with_config(
            configurable={"my_property": "b"}
        ).my_custom_function()  # type: ignore[attr-defined]
        == "b"
    ), "function without config can be called w bound config"
    assert (
        configurable_runnable.with_config(
            configurable={"my_property": "b"}
        ).my_custom_function_w_config(  # type: ignore[attr-defined]
        )
        == "b"
    ), "func with config arg can be called w bound config without config"
    assert (
        configurable_runnable.with_config(
            configurable={"my_property": "b"}
        ).my_custom_function_w_config(  # type: ignore[attr-defined]
            config={"configurable": {"my_property": "c"}}
        )
        == "c"
    ), "func with config arg can be called w bound config with config as kwarg"
    assert (
        configurable_runnable.with_config(
            configurable={"my_property": "b"}
        ).my_custom_function_w_kw_config(  # type: ignore[attr-defined]
        )
        == "b"
    ), "function with config kwarg can be called w bound config w/out config"
    assert (
        configurable_runnable.with_config(
            configurable={"my_property": "b"}
        ).my_custom_function_w_kw_config(  # type: ignore[attr-defined]
            config={"configurable": {"my_property": "c"}}
        )
        == "c"
    ), "function with config kwarg can be called w bound config with config"
    assert (
        configurable_runnable.with_config(configurable={"my_property": "b"})
        .with_types()
        .my_custom_function()  # type: ignore[attr-defined]
        == "b"
    ), "function without config can be called w bound config"
    assert (
        configurable_runnable.with_config(configurable={"my_property": "b"})
        .with_types()
        .my_custom_function_w_config(  # type: ignore[attr-defined]
        )
        == "b"
    ), "func with config arg can be called w bound config without config"
    assert (
        configurable_runnable.with_config(configurable={"my_property": "b"})
        .with_types()
        .my_custom_function_w_config(  # type: ignore[attr-defined]

Subdomains

Frequently Asked Questions

What does test_config_passthrough_nested() do?
test_config_passthrough_nested() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_configurable.py.
Where is test_config_passthrough_nested() defined?
test_config_passthrough_nested() is defined in libs/core/tests/unit_tests/runnables/test_configurable.py at line 163.
What does test_config_passthrough_nested() call?
test_config_passthrough_nested() calls 5 function(s): my_custom_function, my_custom_function_w_config, my_custom_function_w_kw_config, my_other_custom_function, my_other_custom_function_w_config.

Analyze Your Own Codebase

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

Try Supermodel Free