Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
12,431 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
12,431
◇
Types & classes
4,007
↳
Endpoints
47
Method
test_for_base_url_returns_self_when_bind_is_moot
No per-host provider is made when the bind can't change where the tokens come from: the profile pins its own `base_url`, or it is a us
tests/lib/test_credentials.py:496
Method
test_fork_and_original_continue_independently
(self, respx_mock: MockRouter)
tests/lib/threads/test_beta_threads.py:1356
Method
test_fork_and_original_continue_independently
(self, respx_mock: MockRouter)
tests/lib/threads/test_async_beta_threads.py:181
Method
test_fork_creates_a_thread_with_the_full_history_and_the_same_fields
(self, respx_mock: MockRouter)
tests/lib/threads/test_beta_threads.py:1333
Method
test_fork_during_a_turn_has_the_history_that_set_messages_params_replaced_the_threads_with
( self, respx_mock: MockRouter )
tests/lib/threads/test_thread_tool_runner.py:237
Method
test_fork_during_a_turn_has_the_history_that_set_messages_params_replaced_the_threads_with
( self, respx_mock: MockRouter )
tests/lib/threads/test_async_beta_threads.py:1262
Function
test_fork_during_build_does_not_block_child
()
tests/test_models.py:1213
Method
test_fork_keeps_the_unsupported_request_behavior
(self, respx_mock: MockRouter)
tests/lib/threads/test_beta_threads.py:1346
Method
test_fork_of_a_thread_that_ends_in_a_partial_reply_sends_it_ahead_of_a_new_message
( self, respx_mock: MockRouter )
tests/lib/threads/test_beta_threads.py:1410
Method
test_fork_of_a_thread_that_ends_in_a_partial_reply_sends_it_ahead_of_a_new_message
( self, respx_mock: MockRouter )
tests/lib/threads/test_async_beta_threads.py:235
Method
test_fork_of_a_thread_that_ends_in_a_partial_reply_sends_the_turn_again_without_it
( self, respx_mock: MockRouter, forks: int, method: str )
tests/lib/threads/test_beta_threads.py:1380
Method
test_fork_of_a_thread_that_ends_in_a_partial_reply_sends_the_turn_again_without_it
( self, respx_mock: MockRouter, forks: int, method: str )
tests/lib/threads/test_async_beta_threads.py:205
Method
test_fork_of_a_thread_that_ends_in_a_whole_reply_sends_the_full_history_with_no_new_message
( self, respx_mock: MockRouter )
tests/lib/threads/test_beta_threads.py:1423
Method
test_fork_of_a_thread_that_ends_in_a_whole_reply_sends_the_full_history_with_no_new_message
( self, respx_mock: MockRouter )
tests/lib/threads/test_async_beta_threads.py:248
Method
test_fork_returns_a_thread_with_no_previous_message_id_without_a_request
(self, respx_mock: MockRouter)
tests/lib/threads/test_beta_threads.py:1321
Function
test_forwards_compat_model_dump_json_method
()
tests/test_models.py:618
Function
test_forwards_compat_model_dump_method
()
tests/test_models.py:554
Method
test_foundry_clients_accept_middleware
(self)
tests/test_middleware.py:2107
Method
test_foundry_runner_threads_by_default
(self, respx_mock: MockRouter)
tests/lib/threads/test_tool_runner_threading.py:860
Method
test_fresh_token_not_refetched
(self)
tests/lib/test_credentials.py:1649
Method
test_full_fixture_tool_wire
(self, respx_mock: MockRouter)
tests/lib/test_refusal_fallback_streaming.py:1470
Method
test_full_surface_present
(self)
tests/lib/test_google_cloud.py:382
Method
test_function_call_with_invalid_input
( self, input_data: dict[str, Any], expected_error_type: type[BaseException], expected_error_msg: str
tests/lib/tools/test_functions.py:111
Method
test_function_call_with_valid_input
(self)
tests/lib/tools/test_functions.py:78
Method
test_function_with_multiple_types
Test function schema conversion with various Python types.
tests/lib/tools/test_functions.py:43
Method
test_function_without_docstring
(self)
tests/lib/tools/test_functions.py:190
Method
test_function_without_type_hints
(self)
tests/lib/tools/test_functions.py:198
Method
test_functional_middleware
(self, respx_mock: MockRouter)
tests/test_middleware.py:776
Method
test_functional_middleware
(self, respx_mock: MockRouter)
tests/test_middleware.py:1510
Method
test_generator_body_survives_retries
( self, respx_mock: MockRouter, client: Anthropic | AsyncAnthropic, monkeypatch: pytest.MonkeyPatch
tests/test_prepare.py:815
Function
test_get_does_not_prepare_a_body
(send: Send, monkeypatch: pytest.MonkeyPatch)
tests/test_prepare.py:568
Method
test_get_platform
(self)
tests/test_client.py:2972
Method
test_get_token_rejects_async_provider
(self)
tests/lib/test_credentials.py:1632
Function
test_given_tracer_provider_is_asked_at_the_first_call
Whatever the registered provider does.
tests/test_tracing.py:371
Function
test_gives_the_timing_from_before_when_the_caller_defers_every_call
(setup: SetupFactory)
tests/lib/tools/test_runner_eager_tools.py:417
Function
test_glob_and_grep_reach_an_allowed_root
(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
tests/lib/tools/test_agent_toolset.py:1256
Function
test_glob_drops_matches_that_cannot_be_canonicalised
(tmp_path: Path)
tests/lib/tools/test_agent_toolset.py:1143
Function
test_glob_mtime_order
(tmp_path: Path)
tests/lib/tools/test_agent_toolset.py:656
Function
test_glob_post_filters_symlink_escape
A symlink traversed mid-pattern must not let a glob result escape the workdir.
tests/lib/tools/test_agent_toolset.py:1128
Function
test_glob_rejects_dotdot_pattern
`Path.glob` honours literal `..` segments — the tool must reject a pattern that would walk out of the workdir before it ever runs.
tests/lib/tools/test_agent_toolset.py:1114
Function
test_glob_with_path
(tmp_path: Path)
tests/lib/tools/test_agent_toolset.py:671
Method
test_global_region_base_url
Test that global region uses the correct base URL.
tests/lib/test_vertex.py:353
Method
test_global_region_base_url
Test that global region uses the correct base URL.
tests/lib/test_vertex.py:874
Method
test_global_tracer_provider_that_cannot_be_loaded_leaves_platform_clients_without_spans
( self, spans: Spans, respx_mock: MockRouter, caplog: pytest.LogCaptureFixture )
tests/test_open_telemetry.py:8126
Method
test_global_tracer_provider_that_cannot_be_loaded_leaves_the_client_without_spans
( self, sync: bool, spans: Spans, respx_mock: MockRouter, caplog: pytest.LogCaptureFixture )
tests/test_open_telemetry.py:8102
Method
test_google_credentials_exposed_without_shadowing_base_attribute
(self)
tests/lib/test_google_cloud.py:372
Function
test_grep_does_not_pass_anthropic_variables_to_rg
(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
tests/lib/tools/test_agent_toolset.py:773
Function
test_grep_finds_match
(tmp_path: Path)
tests/lib/tools/test_agent_toolset.py:787
Function
test_grep_ignores_relative_path_entries
( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, relative_entry: str )
tests/lib/tools/test_agent_toolset.py:685
Function
test_grep_ignores_the_ripgrep_config_file
(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
tests/lib/tools/test_agent_toolset.py:1186
Function
test_grep_passes_no_config_to_rg
(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
tests/lib/tools/test_agent_toolset.py:1201
Function
test_grep_passes_over_an_rg_inside_the_workdir_or_an_allowed_root
( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, entry: str )
tests/lib/tools/test_agent_toolset.py:729
Function
test_grep_runs_no_rg_when_an_allowed_root_cannot_be_resolved
( tmp_path: Path, monkeypatch: pytest.MonkeyPatch )
tests/lib/tools/test_agent_toolset.py:755
Function
test_grep_runs_the_rg_named_for_the_platform
( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, os_name: str, expected: str )
tests/lib/tools/test_agent_toolset.py:709
Function
test_grep_single_file_path
Fallback walker must handle a file path, not just directories.
tests/lib/tools/test_agent_toolset.py:796
Function
test_grep_skips_symlinked_files
The fallback walker must not read through a symlink that escapes the workdir.
tests/lib/tools/test_agent_toolset.py:1153
Function
test_grep_walk_leaves_the_hosts_signal_alone
(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
tests/lib/tools/test_agent_toolset.py:824
Function
test_grep_walk_stops_a_backtracking_pattern
(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
tests/lib/tools/test_agent_toolset.py:809
Function
test_grep_walk_works_off_the_main_thread
(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
tests/lib/tools/test_agent_toolset.py:861
Function
test_grep_walk_works_without_interval_timers
( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, error: type[Exception] )
tests/lib/tools/test_agent_toolset.py:847
Function
test_grep_without_rg_reads_only_regular_files
(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
tests/lib/tools/test_agent_toolset.py:1169
Method
test_handle_async_is_passthrough
(self)
tests/test_middleware.py:510
Method
test_handle_is_passthrough
(self)
tests/test_middleware.py:498
Function
test_handle_item_falls_back_to_env_vars
(monkeypatch: pytest.MonkeyPatch)
tests/lib/environments/test_worker.py:690
Function
test_handle_item_falls_back_to_work_secret_env_var
`work_secret` falls back to `ANTHROPIC_WORK_SECRET` (the env var the `worker poll --on-work` command sets alongside the others); when neither
tests/lib/environments/test_worker.py:776
Function
test_handle_item_keyless_with_a_tokenless_secret_raises
A work secret that yields no sessions token, with no environment key to fall back to, must not run the item unauthenticated: the error names both
tests/lib/environments/test_worker.py:860
Function
test_handle_item_missing_required_raises
(monkeypatch: pytest.MonkeyPatch)
tests/lib/environments/test_worker.py:804
Function
test_handle_item_runs_keyless_on_a_token_bearing_secret
With no environment key anywhere — argument, constructor, or env var — a work secret whose payload carries a sessions token is credential enough:
tests/lib/environments/test_worker.py:833
Function
test_handle_item_services_a_single_claimed_item
(monkeypatch: pytest.MonkeyPatch)
tests/lib/environments/test_worker.py:622
Function
test_handle_item_stops_the_item_of_a_terminated_session
A terminated session accepts no tool result, so the worker starts no tool runner for it and force-stops the work item. It does so even when the se
tests/lib/environments/test_worker.py:664
Function
test_handle_item_uses_constructor_environment_key
`environment_key` resolves to the worker's own key when not passed and no env var is set.
tests/lib/environments/test_worker.py:721
Function
test_handle_item_uses_work_secret_argument
An explicit `work_secret` payload supplies the per-item Bearer credential (its sessions token); an `environment_key` passed alongside it is on
tests/lib/environments/test_worker.py:746
Method
test_handles_null_body
(self)
tests/lib/test_aws_auth.py:526
Method
test_hardcoded_query_params_in_url
(self, client: Anthropic)
tests/test_client.py:671
Method
test_hardcoded_query_params_in_url
(self, async_client: AsyncAnthropic)
tests/test_client.py:2124
Function
test_has_all_resources
()
tests/lib/test_aws.py:400
Method
test_headers_default_to_empty_mapping
(self)
tests/test_middleware.py:403
Function
test_heartbeat_412_releases_item_without_stopping_it
A 412 on the heartbeat means the server cleared this worker's lease (re-queued the item, or another worker holds it). The run ends, the item i
tests/lib/environments/test_worker.py:487
Function
test_heartbeat_conflict_is_retried_until_the_lease_is_stale
( monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture )
tests/lib/environments/test_worker.py:1144
Function
test_heartbeat_keeps_beating_while_a_sync_tool_blocks
Heartbeat loop and tool call share one task group, as they do in `_handle_item`.
tests/lib/environments/test_worker.py:1186
Function
test_heartbeat_permanent_4xx_stops_immediately
( monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture )
tests/lib/environments/test_worker.py:1174
Function
test_heartbeat_starts_before_skill_download
Regression: the lease heartbeat must already be running while skills are downloaded. Skill setup (`AgentToolContext.__aenter__`) can take lon
tests/lib/environments/test_worker.py:1004
Function
test_heartbeat_stop_still_force_stops
A heartbeat reporting `state == "stopped"` ends the run and the item is still force-stopped on the way out — only a *lost* lease skips that.
tests/lib/environments/test_worker.py:529
Function
test_heartbeat_that_never_returns_is_cut_off_each_interval
( monkeypatch: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture )
tests/lib/environments/test_worker.py:1162
Function
test_held_ask_call_does_not_block_other_dispatches
Holding an ask-gated call must not stall the rest of the queue: an ungated call arriving after it executes immediately, and the gated call fol
tests/lib/tools/test_session_runner.py:950
Function
test_held_ask_call_keeps_runner_alive
While a call awaits its confirmation the runner must keep running — even if history (defensively) ends on an `end_turn` idle — so the verdict
tests/lib/tools/test_session_runner.py:822
Method
test_held_response_stays_open
(self, client: Anthropic, held: Held[Any, Any])
tests/test_streaming.py:231
Method
test_held_response_stays_open
(self, async_client: AsyncAnthropic, held: AsyncHeld[Any, Any])
tests/test_streaming.py:279
Function
test_helper_header
()
tests/lib/test_stainless_helpers.py:32
Function
test_helper_header_is_an_append_header
()
tests/lib/test_stainless_helpers.py:36
Function
test_holds_a_call_that_is_deferred
(setup: SetupFactory, at: str)
tests/lib/tools/test_runner_eager_tools.py:405
Function
test_holds_a_call_that_the_caller_defers_until_the_loop_body_ends
(setup: SetupFactory)
tests/lib/tools/test_runner_eager_tools.py:82
Method
test_http_4xx_does_not_retain_assertion
(self)
tests/lib/test_credentials.py:4889
Method
test_http_base_url_in_config_file_raises_anthropic_error
( self, clean_env: pytest.MonkeyPatch, tmp_path: pathlib.Path )
tests/lib/test_credentials.py:4049
Method
test_http_base_url_on_workload_provider_raises_anthropic_error
(self)
tests/lib/test_credentials.py:4040
Method
test_http_base_url_rejected
(self)
tests/lib/test_credentials.py:3305
Method
test_http_client_timeout_option
(self)
tests/test_client.py:364
Method
test_http_client_timeout_option
(self)
tests/test_client.py:1811
Method
test_httpx_objects_rejected
(self, client: Anthropic)
tests/test_client.py:500
Method
test_httpx_objects_rejected
(self, async_client: AsyncAnthropic)
tests/test_client.py:1949
← previous
next →
6,401–6,500 of 12,431, ranked by callers