Home / Function/ test_experimental_markdown_syntax_text_splitter_header_configuration() — langchain Function Reference

test_experimental_markdown_syntax_text_splitter_header_configuration() — langchain Function Reference

Architecture documentation for the test_experimental_markdown_syntax_text_splitter_header_configuration() function in test_text_splitters.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  19f82ebd_d8b4_137a_3888_ff0d1bcae780["test_experimental_markdown_syntax_text_splitter_header_configuration()"]
  6d6b8ad4_1cfe_fbb0_e58e_76a50487c135["test_text_splitters.py"]
  19f82ebd_d8b4_137a_3888_ff0d1bcae780 -->|defined in| 6d6b8ad4_1cfe_fbb0_e58e_76a50487c135
  style 19f82ebd_d8b4_137a_3888_ff0d1bcae780 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/text-splitters/tests/unit_tests/test_text_splitters.py lines 1751–1793

def test_experimental_markdown_syntax_text_splitter_header_configuration() -> None:
    """Test experimental markdown syntax splitter."""
    headers_to_split_on = [("#", "Encabezamiento 1")]

    markdown_splitter = ExperimentalMarkdownSyntaxTextSplitter(
        headers_to_split_on=headers_to_split_on
    )
    output = markdown_splitter.split_text(EXPERIMENTAL_MARKDOWN_DOCUMENT)

    expected_output = [
        Document(
            page_content=(
                "Content for header 1\n"
                "## Header 2\n"
                "Content for header 2\n"
                "### Header 3\n"
                "Content for header 3\n"
                "## Header 2 Again\n"
                "This should be tagged with Header 1 and Header 2 Again\n"
            ),
            metadata={"Encabezamiento 1": "My Header 1"},
        ),
        Document(
            page_content=(
                "```python\ndef func_definition():\n   "
                "print('Keep the whitespace consistent')\n```\n"
            ),
            metadata={"Code": "python", "Encabezamiento 1": "My Header 1"},
        ),
        Document(
            page_content="We should also split on the horizontal line\n",
            metadata={"Encabezamiento 1": "Header 1 again"},
        ),
        Document(
            page_content=(
                "This will be a new doc but with the same header metadata\n\n"
                "And it includes a new paragraph"
            ),
            metadata={"Encabezamiento 1": "Header 1 again"},
        ),
    ]

    assert output == expected_output

Domain

Subdomains

Frequently Asked Questions

What does test_experimental_markdown_syntax_text_splitter_header_configuration() do?
test_experimental_markdown_syntax_text_splitter_header_configuration() is a function in the langchain codebase, defined in libs/text-splitters/tests/unit_tests/test_text_splitters.py.
Where is test_experimental_markdown_syntax_text_splitter_header_configuration() defined?
test_experimental_markdown_syntax_text_splitter_header_configuration() is defined in libs/text-splitters/tests/unit_tests/test_text_splitters.py at line 1751.

Analyze Your Own Codebase

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

Try Supermodel Free