Home / Function/ test_html_splitter_with_custom_extractor() — langchain Function Reference

test_html_splitter_with_custom_extractor() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/text-splitters/tests/unit_tests/test_text_splitters.py lines 3363–3386

def test_html_splitter_with_custom_extractor() -> None:
    """Test HTML splitting with a custom extractor."""
    html_content = """
    <h1>Section 1</h1>
    <p>This is an iframe:</p>
    <iframe src="http://example.com"></iframe>
    """
    with suppress_langchain_beta_warning():
        splitter = HTMLSemanticPreservingSplitter(
            headers_to_split_on=[("h1", "Header 1")],
            custom_handlers={"iframe": custom_iframe_extractor},
            max_chunk_size=1000,
        )
    documents = splitter.split_text(html_content)

    expected = [
        Document(
            page_content="This is an iframe: "
            "[iframe:http://example.com](http://example.com)",
            metadata={"Header 1": "Section 1"},
        ),
    ]

    assert documents == expected

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free