test_get_buffer_string_xml_tool_calls_escaping() — langchain Function Reference
Architecture documentation for the test_get_buffer_string_xml_tool_calls_escaping() function in test_utils.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 66b2c8d2_9b4a_d200_6fda_5576cdf927c0["test_get_buffer_string_xml_tool_calls_escaping()"] 03f6a5ae_d57a_eb66_626a_b9e082b763ea["test_utils.py"] 66b2c8d2_9b4a_d200_6fda_5576cdf927c0 -->|defined in| 03f6a5ae_d57a_eb66_626a_b9e082b763ea style 66b2c8d2_9b4a_d200_6fda_5576cdf927c0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/messages/test_utils.py lines 2075–2097
def test_get_buffer_string_xml_tool_calls_escaping() -> None:
"""Test XML format escapes special characters in tool calls."""
messages = [
AIMessage(
content="",
tool_calls=[
{
"name": "calculate",
"args": {"expression": "5 < 10 & 10 > 5"},
"id": "call_3",
"type": "tool_call",
}
],
),
]
result = get_buffer_string(messages, format="xml")
# Special characters in tool_calls args should be escaped
assert "<" in result
assert ">" in result
assert "&" in result
# Verify overall structure
assert result.startswith('<message type="ai">')
assert result.endswith("</message>")
Domain
Subdomains
Source
Frequently Asked Questions
What does test_get_buffer_string_xml_tool_calls_escaping() do?
test_get_buffer_string_xml_tool_calls_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_tool_calls_escaping() defined?
test_get_buffer_string_xml_tool_calls_escaping() is defined in libs/core/tests/unit_tests/messages/test_utils.py at line 2075.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free