Home / Function/ test_markdown_list_async() — langchain Function Reference

test_markdown_list_async() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_list_parser.py lines 274–314

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

    text2 = "Items:\n- apple\n- banana\n- 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_markdown_list_async() do?
test_markdown_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_markdown_list_async() defined?
test_markdown_list_async() is defined in libs/core/tests/unit_tests/output_parsers/test_list_parser.py at line 274.
What does test_markdown_list_async() call?
test_markdown_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