test_mermaid_bgcolor_url_encoding() — langchain Function Reference
Architecture documentation for the test_mermaid_bgcolor_url_encoding() function in test_graph.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 5d1025fd_d097_a633_00fc_18754fef32cf["test_mermaid_bgcolor_url_encoding()"] 972d89eb_abd0_b940_67b4_eff75c775ace["test_graph.py"] 5d1025fd_d097_a633_00fc_18754fef32cf -->|defined in| 972d89eb_abd0_b940_67b4_eff75c775ace style 5d1025fd_d097_a633_00fc_18754fef32cf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/runnables/test_graph.py lines 659–680
def test_mermaid_bgcolor_url_encoding() -> None:
"""Test that background_color with special chars is properly URL-encoded.
Regression test for issue #34444: Named colors like 'white' get prefixed
with '!' which must be URL-encoded to avoid HTTP 400 errors from mermaid.ink.
"""
mock_response = MagicMock()
mock_response.status_code = 200
mock_response.content = b"fake image data"
with patch("requests.get", return_value=mock_response) as mock_get:
_render_mermaid_using_api(
"graph TD;\n A --> B;",
background_color="white",
)
assert mock_get.called
url = mock_get.call_args[0][0]
# The '!' character should be URL-encoded as '%21'
assert "%21white" in url or "!white" not in url
# Verify the URL doesn't contain unencoded '!'
assert "bgColor=!white" not in url
Domain
Subdomains
Source
Frequently Asked Questions
What does test_mermaid_bgcolor_url_encoding() do?
test_mermaid_bgcolor_url_encoding() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_graph.py.
Where is test_mermaid_bgcolor_url_encoding() defined?
test_mermaid_bgcolor_url_encoding() is defined in libs/core/tests/unit_tests/runnables/test_graph.py at line 659.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free