Home / Function/ test_runnable_gen() — langchain Function Reference

test_runnable_gen() — langchain Function Reference

Architecture documentation for the test_runnable_gen() function in test_runnable.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c524acaf_5dca_5dbd_855c_a6af20aa19c7["test_runnable_gen()"]
  26df6ad8_0189_51d0_c3c1_6c3248893ff5["test_runnable.py"]
  c524acaf_5dca_5dbd_855c_a6af20aa19c7 -->|defined in| 26df6ad8_0189_51d0_c3c1_6c3248893ff5
  593bb72a_4695_6c93_b95c_e277aca006ae["batch()"]
  c524acaf_5dca_5dbd_855c_a6af20aa19c7 -->|calls| 593bb72a_4695_6c93_b95c_e277aca006ae
  fb618d44_c03b_ea8b_385b_2278dfb173d4["invoke()"]
  c524acaf_5dca_5dbd_855c_a6af20aa19c7 -->|calls| fb618d44_c03b_ea8b_385b_2278dfb173d4
  style c524acaf_5dca_5dbd_855c_a6af20aa19c7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_runnable.py lines 4862–4880

def test_runnable_gen() -> None:
    """Test that a generator can be used as a runnable."""

    def gen(_: Iterator[Any]) -> Iterator[int]:
        yield 1
        yield 2
        yield 3

    runnable = RunnableGenerator(gen)

    assert runnable.get_input_jsonschema() == {"title": "gen_input"}
    assert runnable.get_output_jsonschema() == {
        "title": "gen_output",
        "type": "integer",
    }

    assert runnable.invoke(None) == 6
    assert list(runnable.stream(None)) == [1, 2, 3]
    assert runnable.batch([None, None]) == [6, 6]

Domain

Subdomains

Frequently Asked Questions

What does test_runnable_gen() do?
test_runnable_gen() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_runnable.py.
Where is test_runnable_gen() defined?
test_runnable_gen() is defined in libs/core/tests/unit_tests/runnables/test_runnable.py at line 4862.
What does test_runnable_gen() call?
test_runnable_gen() calls 2 function(s): batch, invoke.

Analyze Your Own Codebase

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

Try Supermodel Free