test_method_results() — anthropic-sdk-python Function Reference
Architecture documentation for the test_method_results() function in test_batches.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 3dbd2517_4f0c_ecd3_73d4_49d97bda88ed["test_method_results()"] 9a832258_7f6b_3def_c68d_76dcd3360ad4["TestBatches"] 3dbd2517_4f0c_ecd3_73d4_49d97bda88ed -->|defined in| 9a832258_7f6b_3def_c68d_76dcd3360ad4 43ea5a5e_b2e5_67da_4286_d9f4972d1a36["test_method_results()"] 43ea5a5e_b2e5_67da_4286_d9f4972d1a36 -->|calls| 3dbd2517_4f0c_ecd3_73d4_49d97bda88ed 43ea5a5e_b2e5_67da_4286_d9f4972d1a36["test_method_results()"] 3dbd2517_4f0c_ecd3_73d4_49d97bda88ed -->|calls| 43ea5a5e_b2e5_67da_4286_d9f4972d1a36 style 3dbd2517_4f0c_ecd3_73d4_49d97bda88ed fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/api_resources/messages/test_batches.py lines 249–275
def test_method_results(self, client: Anthropic, respx_mock: MockRouter) -> None:
respx_mock.get("/v1/messages/batches/message_batch_id").mock(
return_value=httpx.Response(200, json={"results_url": "/v1/messages/batches/message_batch_id/results"})
)
respx_mock.get("/v1/messages/batches/message_batch_id/results").mock(
return_value=httpx.Response(
200, content="\n".join([json.dumps({"foo": "bar"}), json.dumps({"bar": "baz"})])
)
)
results = client.beta.messages.batches.results(
message_batch_id="message_batch_id",
)
assert results.http_response is not None
assert not results.http_response.is_stream_consumed
i = -1
for result in results:
i += 1
if i == 0:
assert result.to_dict() == {"foo": "bar"}
elif i == 1:
assert result.to_dict() == {"bar": "baz"}
else:
raise RuntimeError(f"iterated too many times, expected 2 times but got {i + 1}")
assert i == 1
assert results.http_response.is_stream_consumed
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does test_method_results() do?
test_method_results() is a function in the anthropic-sdk-python codebase, defined in tests/api_resources/messages/test_batches.py.
Where is test_method_results() defined?
test_method_results() is defined in tests/api_resources/messages/test_batches.py at line 249.
What does test_method_results() call?
test_method_results() calls 1 function(s): test_method_results.
What calls test_method_results()?
test_method_results() is called by 1 function(s): test_method_results.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free