Home / Function/ test_multiple_items() — langchain Function Reference

test_multiple_items() — langchain Function Reference

Architecture documentation for the test_multiple_items() function in test_list_parser.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  43ba5048_072f_c020_d007_4f2ed0f9b2de["test_multiple_items()"]
  8ae9f33a_614d_1533_e9a3_2a17ed09b1eb["test_list_parser.py"]
  43ba5048_072f_c020_d007_4f2ed0f9b2de -->|defined in| 8ae9f33a_614d_1533_e9a3_2a17ed09b1eb
  style 43ba5048_072f_c020_d007_4f2ed0f9b2de fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_list_parser.py lines 52–67

def test_multiple_items() -> None:
    """Test that a string with multiple comma-separated items is parsed to a list."""
    parser = CommaSeparatedListOutputParser()
    text = "foo,bar,baz"
    expected = ["foo", "bar", "baz"]

    assert parser.parse(text) == expected
    assert add(parser.transform(t for t in text)) == expected
    assert list(parser.transform(t for t in text)) == [[a] for a in expected]
    assert list(parser.transform(t for t in text.splitlines(keepends=True))) == [
        [a] for a in expected
    ]
    assert list(
        parser.transform(" " + t if i > 0 else t for i, t in enumerate(text.split(" ")))
    ) == [[a] for a in expected]
    assert list(parser.transform(iter([text]))) == [[a] for a in expected]

Subdomains

Frequently Asked Questions

What does test_multiple_items() do?
test_multiple_items() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/output_parsers/test_list_parser.py.
Where is test_multiple_items() defined?
test_multiple_items() is defined in libs/core/tests/unit_tests/output_parsers/test_list_parser.py at line 52.

Analyze Your Own Codebase

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

Try Supermodel Free