test_context_manager() — anthropic-sdk-python Function Reference
Architecture documentation for the test_context_manager() function in test_beta_messages.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 78655d86_e01f_f848_1839_a877c36f94a5["test_context_manager()"] 9bc201ea_a885_b5a7_1802_da159bef751a["TestSyncMessages"] 78655d86_e01f_f848_1839_a877c36f94a5 -->|defined in| 9bc201ea_a885_b5a7_1802_da159bef751a d7d85fbf_ea7f_b02a_9f96_2044dd6ec764["test_context_manager()"] d7d85fbf_ea7f_b02a_9f96_2044dd6ec764 -->|calls| 78655d86_e01f_f848_1839_a877c36f94a5 d7d85fbf_ea7f_b02a_9f96_2044dd6ec764["test_context_manager()"] 78655d86_e01f_f848_1839_a877c36f94a5 -->|calls| d7d85fbf_ea7f_b02a_9f96_2044dd6ec764 d1b2725b_0ccb_90ce_868b_51db8c397a89["get_response()"] 78655d86_e01f_f848_1839_a877c36f94a5 -->|calls| d1b2725b_0ccb_90ce_868b_51db8c397a89 style 78655d86_e01f_f848_1839_a877c36f94a5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/lib/streaming/test_beta_messages.py lines 230–248
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.beta.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_beta_messages.py.
Where is test_context_manager() defined?
test_context_manager() is defined in tests/lib/streaming/test_beta_messages.py at line 230.
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