test_single_item() — langchain Function Reference
Architecture documentation for the test_single_item() function in test_list_parser.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD eb0cddea_d4c0_a478_593e_8857948c8627["test_single_item()"] 8ae9f33a_614d_1533_e9a3_2a17ed09b1eb["test_list_parser.py"] eb0cddea_d4c0_a478_593e_8857948c8627 -->|defined in| 8ae9f33a_614d_1533_e9a3_2a17ed09b1eb style eb0cddea_d4c0_a478_593e_8857948c8627 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/output_parsers/test_list_parser.py lines 12–27
def test_single_item() -> None:
"""Test that a string with a single item is parsed to a list with that item."""
parser = CommaSeparatedListOutputParser()
text = "foo"
expected = ["foo"]
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]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_single_item() do?
test_single_item() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/output_parsers/test_list_parser.py.
Where is test_single_item() defined?
test_single_item() is defined in libs/core/tests/unit_tests/output_parsers/test_list_parser.py at line 12.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free