test_context_manager() — anthropic-sdk-python Function Reference
Architecture documentation for the test_context_manager() function in test_messages.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD bb206031_6ed6_75bb_2973_4e4a072b1031["test_context_manager()"] dee3798b_de54_17a3_eda7_2fcb6484288c["TestSyncMessages"] bb206031_6ed6_75bb_2973_4e4a072b1031 -->|defined in| dee3798b_de54_17a3_eda7_2fcb6484288c fd7d72e5_d0f6_7fe7_a90d_08126c6c65d9["test_context_manager()"] fd7d72e5_d0f6_7fe7_a90d_08126c6c65d9 -->|calls| bb206031_6ed6_75bb_2973_4e4a072b1031 fd7d72e5_d0f6_7fe7_a90d_08126c6c65d9["test_context_manager()"] bb206031_6ed6_75bb_2973_4e4a072b1031 -->|calls| fd7d72e5_d0f6_7fe7_a90d_08126c6c65d9 d1b2725b_0ccb_90ce_868b_51db8c397a89["get_response()"] bb206031_6ed6_75bb_2973_4e4a072b1031 -->|calls| d1b2725b_0ccb_90ce_868b_51db8c397a89 style bb206031_6ed6_75bb_2973_4e4a072b1031 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/lib/streaming/test_messages.py lines 131–149
def test_context_manager(self, respx_mock: MockRouter) -> None:
respx_mock.post("/v1/messages").mock(
return_value=httpx.Response(200, content=get_response("basic_response.txt"))
)
with sync_client.messages.stream(
max_tokens=1024,
messages=[
{
"role": "user",
"content": "Say hello there!",
}
],
model="claude-3-opus-latest",
) as stream:
assert not stream.response.is_closed
# response should be closed even if the body isn't read
assert stream.response.is_closed
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does test_context_manager() do?
test_context_manager() is a function in the anthropic-sdk-python codebase, defined in tests/lib/streaming/test_messages.py.
Where is test_context_manager() defined?
test_context_manager() is defined in tests/lib/streaming/test_messages.py at line 131.
What does test_context_manager() call?
test_context_manager() calls 2 function(s): get_response, test_context_manager.
What calls test_context_manager()?
test_context_manager() is called by 1 function(s): test_context_manager.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free