Home / Function/ test_get_buffer_string_xml_escaping() — langchain Function Reference

test_get_buffer_string_xml_escaping() — langchain Function Reference

Architecture documentation for the test_get_buffer_string_xml_escaping() function in test_utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  764e02e5_9b0d_990e_a523_28888d12ad56["test_get_buffer_string_xml_escaping()"]
  ea3f8d89_f44b_6738_3cb9_a740a73cfca4["test_utils.py"]
  764e02e5_9b0d_990e_a523_28888d12ad56 -->|defined in| ea3f8d89_f44b_6738_3cb9_a740a73cfca4
  style 764e02e5_9b0d_990e_a523_28888d12ad56 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/test_utils.py lines 1954–1966

def test_get_buffer_string_xml_escaping() -> None:
    """Test XML format properly escapes special characters in content."""
    messages = [
        HumanMessage(content="Is 5 < 10 & 10 > 5?"),
        AIMessage(content='Yes, and here\'s a "quote"'),
    ]
    result = get_buffer_string(messages, format="xml")
    # xml.sax.saxutils.escape escapes <, >, & (not quotes in content)
    expected = (
        '<message type="human">Is 5 &lt; 10 &amp; 10 &gt; 5?</message>\n'
        '<message type="ai">Yes, and here\'s a "quote"</message>'
    )
    assert result == expected

Subdomains

Frequently Asked Questions

What does test_get_buffer_string_xml_escaping() do?
test_get_buffer_string_xml_escaping() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/test_utils.py.
Where is test_get_buffer_string_xml_escaping() defined?
test_get_buffer_string_xml_escaping() is defined in libs/core/tests/unit_tests/messages/test_utils.py at line 1954.

Analyze Your Own Codebase

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

Try Supermodel Free