test_parse_code_json() — langchain Function Reference
Architecture documentation for the test_parse_code_json() function in test_groq.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 78c5d22d_1f8c_7a3e_54bd_712d098926c2["test_parse_code_json()"] 9858a811_d607_0538_c702_16bcd3e0f2c7["test_groq.py"] 78c5d22d_1f8c_7a3e_54bd_712d098926c2 -->|defined in| 9858a811_d607_0538_c702_16bcd3e0f2c7 style 78c5d22d_1f8c_7a3e_54bd_712d098926c2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/messages/block_translators/test_groq.py lines 128–140
def test_parse_code_json() -> None:
"""Test the _parse_code_json helper function."""
# Test valid code JSON
result = _parse_code_json('{"code": "print(\'hello\')"}')
assert result == {"code": "print('hello')"}
# Test code with unescaped quotes (Groq format)
result = _parse_code_json('{"code": "print("hello")"}')
assert result == {"code": 'print("hello")'}
# Test invalid format raises ValueError
with pytest.raises(ValueError, match="Could not extract Python code"):
_parse_code_json('{"invalid": "format"}')
Domain
Subdomains
Source
Frequently Asked Questions
What does test_parse_code_json() do?
test_parse_code_json() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/block_translators/test_groq.py.
Where is test_parse_code_json() defined?
test_parse_code_json() is defined in libs/core/tests/unit_tests/messages/block_translators/test_groq.py at line 128.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free