Home / Function/ test_numbered_list_async() — langchain Function Reference

test_numbered_list_async() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c4f0d95b_1fb4_bd49_f05c_b46fd32e4b50["test_numbered_list_async()"]
  e85257af_7552_a45a_4078_5123cfebbddc["test_list_parser.py"]
  c4f0d95b_1fb4_bd49_f05c_b46fd32e4b50 -->|defined in| e85257af_7552_a45a_4078_5123cfebbddc
  3299dc23_b3d1_1446_4d13_0690b549b0c0["aiter_from_iter()"]
  c4f0d95b_1fb4_bd49_f05c_b46fd32e4b50 -->|calls| 3299dc23_b3d1_1446_4d13_0690b549b0c0
  style c4f0d95b_1fb4_bd49_f05c_b46fd32e4b50 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_list_parser.py lines 231–271

async def test_numbered_list_async() -> None:
    parser = NumberedListOutputParser()
    text1 = (
        "Your response should be a numbered list with each item on a new line. "
        "For example: \n\n1. foo\n\n2. bar\n\n3. baz"
    )

    text2 = "Items:\n\n1. apple\n\n2. banana\n\n3. cherry"

    text3 = "No items in the list."

    for text, expected in [
        (text1, ["foo", "bar", "baz"]),
        (text2, ["apple", "banana", "cherry"]),
        (text3, []),
    ]:
        expectedlist = [[a] for a in expected]
        assert await parser.aparse(text) == expected
        assert await aadd(parser.atransform(aiter_from_iter(t for t in text))) == (
            expected or None
        )
        assert [
            a async for a in parser.atransform(aiter_from_iter(t for t in text))
        ] == expectedlist
        assert [
            a
            async for a in parser.atransform(
                aiter_from_iter(t for t in text.splitlines(keepends=True))
            )
        ] == expectedlist
        assert [
            a
            async for a in parser.atransform(
                aiter_from_iter(
                    " " + t if i > 0 else t for i, t in enumerate(text.split(" "))
                )
            )
        ] == expectedlist
        assert [
            a async for a in parser.atransform(aiter_from_iter([text]))
        ] == expectedlist

Domain

Subdomains

Frequently Asked Questions

What does test_numbered_list_async() do?
test_numbered_list_async() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/output_parsers/test_list_parser.py.
Where is test_numbered_list_async() defined?
test_numbered_list_async() is defined in libs/core/tests/unit_tests/output_parsers/test_list_parser.py at line 231.
What does test_numbered_list_async() call?
test_numbered_list_async() calls 1 function(s): aiter_from_iter.

Analyze Your Own Codebase

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

Try Supermodel Free