Home / Function/ test_xml_escaping_minimal() — langchain Function Reference

test_xml_escaping_minimal() — langchain Function Reference

Architecture documentation for the test_xml_escaping_minimal() function in test_xml.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  0045840d_d2c0_02f7_f140_deb2dddaceab["test_xml_escaping_minimal()"]
  8e952513_6b41_3d5a_f5ac_e4a1e0bd30b1["test_xml.py"]
  0045840d_d2c0_02f7_f140_deb2dddaceab -->|defined in| 8e952513_6b41_3d5a_f5ac_e4a1e0bd30b1
  style 0045840d_d2c0_02f7_f140_deb2dddaceab fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/agents/format_scratchpad/test_xml.py lines 44–62

def test_xml_escaping_minimal() -> None:
    """Test that XML tags in tool names are escaped with minimal format."""
    # Arrange
    agent_action = AgentAction(
        tool="search<tool>nested</tool>", tool_input="query<input>test</input>", log=""
    )
    observation = "Found <observation>result</observation>"
    intermediate_steps = [(agent_action, observation)]

    # Act
    result = format_xml(intermediate_steps, escape_format="minimal")

    # Assert - XML tags should be replaced with custom delimiters
    expected_result = (
        "<tool>search[[tool]]nested[[/tool]]</tool>"
        "<tool_input>query<input>test</input></tool_input>"
        "<observation>Found [[observation]]result[[/observation]]</observation>"
    )
    assert result == expected_result

Domain

Subdomains

Frequently Asked Questions

What does test_xml_escaping_minimal() do?
test_xml_escaping_minimal() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/format_scratchpad/test_xml.py.
Where is test_xml_escaping_minimal() defined?
test_xml_escaping_minimal() is defined in libs/langchain/tests/unit_tests/agents/format_scratchpad/test_xml.py at line 44.

Analyze Your Own Codebase

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

Try Supermodel Free