Home / Function/ test_html_splitter_preserve_nested_in_paragraph() — langchain Function Reference

test_html_splitter_preserve_nested_in_paragraph() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/text-splitters/tests/unit_tests/test_text_splitters.py lines 3550–3569

def test_html_splitter_preserve_nested_in_paragraph() -> None:
    """Test preserving deeply nested elements (code inside paragraph).

    tests the case where a preserved element (<code>) is nested
    inside a non-container element (<p>)
    """
    html_content = "<p>before <code>KEEP_THIS</code> after</p>"
    with suppress_langchain_beta_warning():
        splitter = HTMLSemanticPreservingSplitter(
            headers_to_split_on=[],
            elements_to_preserve=["code"],
        )
    documents = splitter.split_text(html_content)

    assert len(documents) == 1
    content = documents[0].page_content
    # All text should be preserved
    assert "before" in content
    assert "KEEP_THIS" in content
    assert "after" in content

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free