Home / Function/ test_graph_single_runnable() — langchain Function Reference

test_graph_single_runnable() — langchain Function Reference

Architecture documentation for the test_graph_single_runnable() function in test_graph.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  04e30510_419b_199a_003b_c9eaa8359e43["test_graph_single_runnable()"]
  83e2cebc_592b_5a1b_c581_48dfbd3d53cf["test_graph.py"]
  04e30510_419b_199a_003b_c9eaa8359e43 -->|defined in| 83e2cebc_592b_5a1b_c581_48dfbd3d53cf
  style 04e30510_419b_199a_003b_c9eaa8359e43 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_graph.py lines 27–51

def test_graph_single_runnable(snapshot: SnapshotAssertion) -> None:
    runnable = StrOutputParser()
    graph = StrOutputParser().get_graph()
    first_node = graph.first_node()
    assert first_node is not None
    assert first_node.data.model_json_schema() == runnable.get_input_jsonschema()  # type: ignore[union-attr]
    last_node = graph.last_node()
    assert last_node is not None
    assert last_node.data.model_json_schema() == runnable.get_output_jsonschema()  # type: ignore[union-attr]
    assert len(graph.nodes) == 3
    assert len(graph.edges) == 2
    assert graph.edges[0].source == first_node.id
    assert graph.edges[1].target == last_node.id
    assert graph.draw_ascii() == snapshot(name="ascii")
    assert graph.draw_mermaid() == snapshot(name="mermaid")

    graph.trim_first_node()
    first_node = graph.first_node()
    assert first_node is not None
    assert first_node.data == runnable

    graph.trim_last_node()
    last_node = graph.last_node()
    assert last_node is not None
    assert last_node.data == runnable

Domain

Subdomains

Frequently Asked Questions

What does test_graph_single_runnable() do?
test_graph_single_runnable() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_graph.py.
Where is test_graph_single_runnable() defined?
test_graph_single_runnable() is defined in libs/core/tests/unit_tests/runnables/test_graph.py at line 27.

Analyze Your Own Codebase

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

Try Supermodel Free