Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/anthropics/anthropic-sdk-python
/ functions
Functions
9,455 in github.com/anthropics/anthropic-sdk-python
⨍
Functions
9,455
◇
Types & classes
3,151
↳
Endpoints
25
Method
test_env_var_fallback_chain_first_wins
First env var in the chain takes priority.
tests/lib/test_aws_auth.py:173
Method
test_env_var_fallback_chain_first_wins
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws_auth.py:256
Method
test_env_var_fallback_chain_first_wins
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws_auth.py:341
Method
test_env_var_fallback_chain_none_set
Defaults to SigV4 when no env vars in the chain are set.
tests/lib/test_aws_auth.py:203
Method
test_env_var_fallback_chain_none_set
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws_auth.py:363
Method
test_env_workspace_id_fills_user_oauth
`ANTHROPIC_WORKSPACE_ID` fills `workspace_id` uniformly across profile types — not just federation. This pins the precedence model: ct
tests/lib/test_credentials.py:1464
Function
test_environment_key_threads_through_to_scoped_client
When an environment key is set, the runner asks `_scoped_client` for a Bearer-only sub-client keyed to that environment. The actual header shape
tests/lib/tools/test_session_runner.py:1599
Function
test_environment_worker_accepts_tools_factory
(monkeypatch: pytest.MonkeyPatch)
tests/lib/environments/test_worker.py:306
Function
test_environment_worker_falls_back_when_secret_undecodable
A secret payload that doesn't decode (or carries no sessions token) falls back to the environment key, with a warning that doesn't include the
tests/lib/environments/test_worker.py:377
Function
test_environment_worker_prefers_work_item_secret
A claimed item carrying a per-item `secret` payload authenticates that item's heartbeat / force-stop / session-runner calls with the sessions
tests/lib/environments/test_worker.py:333
Function
test_environment_worker_serves_session
(monkeypatch: pytest.MonkeyPatch)
tests/lib/environments/test_worker.py:235
Function
test_environment_worker_skips_non_session_item
The queue hands the worker a health check instead of a session. There is no session to look up or serve, but the item must still be stopped s
tests/lib/environments/test_worker.py:281
Function
test_environments_public_reexports
A user can type their own code against the public runner API without reaching into a `_`-private module.
tests/lib/tools/test_session_runner.py:1749
Function
test_error_type
( sync: bool, client: Anthropic, async_client: AsyncAnthropic, )
tests/test_streaming.py:223
Method
test_error_with_retryable_cause_is_retried
( self, respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch )
tests/test_middleware.py:869
Method
test_eu_region_base_url
Test that us region uses the correct base URL.
tests/lib/test_vertex.py:196
Method
test_eu_region_base_url
Test that eu region uses the correct base URL.
tests/lib/test_vertex.py:390
Function
test_event_missing_data
(sync: bool, client: Anthropic, async_client: AsyncAnthropic)
tests/test_streaming.py:50
Function
test_event_start_for_a_non_agent_message_preview_returns_none
()
tests/lib/sessions/test_accumulate.py:64
Function
test_event_start_returns_a_fresh_empty_snapshot_from_none
()
tests/lib/sessions/test_accumulate.py:56
Function
test_every_call_to_an_unregistered_family_in_a_turn_says_not_found
( client: Anthropic, async_client: AsyncAnthropic, respx_mock: MockRouter, flavour: str )
tests/lib/tools/toolsets/test_runner.py:615
Function
test_every_confirmation_placeholder_has_a_template_field
()
tests/lib/tools/toolsets/test_computer_registry.py:87
Function
test_every_confirmation_placeholder_has_a_template_field
()
tests/lib/tools/toolsets/test_registry.py:115
Function
test_every_documented_name_is_exported
()
tests/lib/tools/toolsets/test_surface.py:47
Function
test_every_documented_name_is_exported
()
tests/lib/tools/toolsets/test_computer_surface.py:42
Function
test_every_member_is_enabled_by_default
()
tests/lib/tools/toolsets/test_computer_registry.py:40
Function
test_every_pure_action_has_confirmation_text_and_tab_members_render_state_only
()
tests/lib/tools/toolsets/test_registry.py:82
Function
test_every_state_change_kind_is_either_tab_opened_or_a_download_kind
A new change kind with a `url` in the generated union must be added to DOWNLOAD_TYPES, or the SDK neither bounds its `url` nor checks its `path` a
tests/lib/tools/toolsets/test_registry.py:123
Function
test_every_stop_reason_is_classified
()
tests/lib/tools/test_runners.py:802
Method
test_exchange
(self, respx_mock: MockRouter)
tests/lib/test_credentials.py:1044
Method
test_exchange_federation_assertion_helper
(self, respx_mock: MockRouter)
tests/lib/test_credentials.py:1142
Method
test_exchange_federation_assertion_http_rejected
(self)
tests/lib/test_credentials.py:1216
Function
test_execute_dispatches_to_the_member_method_and_refuses_unknown_names
()
tests/lib/tools/toolsets/test_interface.py:220
Function
test_execute_dispatches_to_the_member_method_and_refuses_unknown_names
()
tests/lib/tools/toolsets/test_computer_interface.py:136
Function
test_existing_text_index_appends
()
tests/lib/sessions/test_accumulate.py:78
Method
test_expired_but_nonzero_expiry_keeps_single_flight
Only exactly `expires_at=0` opts out of single-flight; any other past value is an expired token.
tests/lib/test_credentials.py:1751
Function
test_expired_credentials_refreshed
(respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_google_cloud.py:327
Method
test_expired_is_mandatory
(self)
tests/lib/test_credentials.py:1649
Method
test_explicit_api_key_shadows_explicit_config
Explicit `api_key=` + explicit `config=` is an explicit-explicit shadow case: the static api_key wins at the header level and the conf
tests/lib/test_credentials.py:2906
Method
test_explicit_api_key_shadows_explicit_credentials_with_warning
When both explicit `api_key=` AND explicit `credentials=` are passed, the static api_key wins at the header level and credentials is s
tests/lib/test_credentials.py:4166
Method
test_explicit_auth_token_shadows_explicit_credentials_with_warning
( self, caplog: pytest.LogCaptureFixture )
tests/lib/test_credentials.py:4177
Function
test_explicit_aws_creds_suppress_env_api_key
Explicit SigV4 constructor args should suppress ANTHROPIC_AWS_API_KEY env var.
tests/lib/test_aws.py:324
Method
test_explicit_base_url_needs_no_location
(self)
tests/lib/test_google_cloud.py:79
Method
test_explicit_config_beats_env_api_key
Explicit `config=` is step 1 and beats env `ANTHROPIC_API_KEY` (step 2). The env api_key is ignored entirely and the config-derived cr
tests/lib/test_credentials.py:2925
Method
test_explicit_config_beats_env_api_key
Explicit `config=` is also step 1 and beats env api_key.
tests/lib/test_credentials.py:4143
Function
test_explicit_credential_suppresses_adc
( respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch, kwarg: dict[str, Any] )
tests/lib/test_google_cloud.py:383
Function
test_explicit_credential_suppresses_adc_async
( respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch )
tests/lib/test_google_cloud.py:404
Method
test_explicit_credentials_beats_env_api_key
Per spec, explicit `credentials=` is step 1 and beats env `ANTHROPIC_API_KEY` (step 2). The credentials provider wins, env api_key is
tests/lib/test_credentials.py:4114
Method
test_explicit_credentials_beats_env_auth_token
( self, clean_env: pytest.MonkeyPatch, caplog: pytest.LogCaptureFixture )
tests/lib/test_credentials.py:4131
Method
test_explicit_creds_returns_true
(self)
tests/lib/test_aws_auth.py:52
Method
test_explicit_creds_suppress_env_api_key
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_aws_auth.py:109
Method
test_explicit_location_arg_beats_env
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_google_cloud.py:137
Method
test_explicit_profile
(self, tmp_path: pathlib.Path)
tests/lib/test_credentials.py:964
Method
test_explicit_profile_beats_env_api_key
Explicit `profile=` is a constructor argument and beats env `ANTHROPIC_API_KEY` — the env var is not consulted.
tests/lib/test_credentials.py:2969
Method
test_explicit_profile_beats_env_federation
Step 3 (ANTHROPIC_PROFILE) sits above step 4 (env federation). An explicit profile selection wins over a federation-configured environ
tests/lib/test_credentials.py:2227
Method
test_explicit_project_arg_beats_env
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_google_cloud.py:123
Method
test_exposes_configured_middleware
(self)
tests/test_middleware.py:1892
Method
test_external
(self, tmp_path: pathlib.Path)
tests/lib/test_credentials.py:261
Method
test_external_missing_credentials_file
(self, tmp_path: pathlib.Path)
tests/lib/test_credentials.py:286
Method
test_external_no_expiry
(self, tmp_path: pathlib.Path)
tests/lib/test_credentials.py:272
Method
test_external_rereads_credentials_on_each_call
An external process rotates the credentials file; config stays fixed.
tests/lib/test_credentials.py:276
Function
test_extra_body_is_merged_in
(send: Send)
tests/test_prepare.py:222
Method
test_extra_headers_case_insensitive
(self, client: Anthropic)
tests/test_client.py:490
Method
test_extra_headers_case_insensitive
(self, async_client: AsyncAnthropic)
tests/test_client.py:1787
Method
test_extra_headers_omit_removes_default_header_case_insensitively
(self, client_cls: ClientClass)
tests/test_header_case_sensitivity.py:131
Method
test_extra_headers_omit_removes_sdk_header_case_insensitively
(self, client_cls: ClientClass)
tests/test_header_case_sensitivity.py:139
Method
test_extra_headers_replace_default_headers_case_insensitively
(self, client_cls: ClientClass)
tests/test_header_case_sensitivity.py:71
Method
test_extra_headers_replace_generated_header_param_case_insensitively
(self)
tests/test_header_case_sensitivity.py:78
Method
test_extra_headers_replace_sdk_header_case_insensitively
(self, client_cls: ClientClass)
tests/test_header_case_sensitivity.py:92
Function
test_extra_properties
()
tests/test_models.py:1020
Method
test_extra_query_iterator_survives_pagination
( self, respx_mock: MockRouter, client: Anthropic | AsyncAnthropic )
tests/test_prepare.py:835
Function
test_extra_query_omit_removes_default_query
(send: Send)
tests/test_prepare.py:520
Function
test_extract_drops_setuid_setgid_sticky
(make: ArchiveModeMaker, tmp_path: Path)
tests/lib/tools/test_skills.py:229
Method
test_extract_files_does_not_mutate_original_nested_array_path
(self)
tests/test_files.py:175
Method
test_extract_files_does_not_mutate_original_top_level
(self)
tests/test_files.py:164
Function
test_extract_flat_archive_unchanged
(make: ArchiveMaker, tmp_path: Path)
tests/lib/tools/test_skills.py:153
Function
test_extract_refuses_zip_slip
(tmp_path: Path)
tests/lib/tools/test_skills.py:162
Function
test_extract_response_type_binary_response
()
tests/test_response.py:51
Function
test_extract_response_type_concrete_subclasses
()
tests/test_response.py:45
Function
test_extract_response_type_direct_class_missing_type_arg
()
tests/test_response.py:37
Function
test_extract_response_type_direct_classes
()
tests/test_response.py:31
Function
test_extract_strips_skill_wrapper_dir
(make: ArchiveMaker, tmp_path: Path)
tests/lib/tools/test_skills.py:134
Function
test_extract_type_var
()
tests/test_utils/test_typing.py:27
Function
test_extract_type_var_generic_subclass
()
tests/test_utils/test_typing.py:38
Function
test_extract_type_var_generic_subclass_different_ordering_multiple
()
tests/test_utils/test_typing.py:67
Function
test_extract_type_var_generic_subclass_multiple
()
tests/test_utils/test_typing.py:58
Function
test_extract_type_var_multiple
()
tests/test_utils/test_typing.py:49
Function
test_failed_compaction_request_is_not_retried_and_frees_the_messages_async
(respx_mock: MockRouter)
tests/lib/tools/test_runners.py:3166
Function
test_failed_compaction_request_is_not_retried_and_frees_the_messages_sync
(respx_mock: MockRouter)
tests/lib/tools/test_runners.py:3145
Method
test_failed_writeback_after_refresh_does_not_retain_tokens
A refresh that succeeds but fails to persist raises the write error (the refresh token may have rotated server-side) — but the propagating
tests/lib/test_credentials.py:4735
Method
test_fallback_credit_usage_propagated
(self, respx_mock: MockRouter)
tests/lib/streaming/test_beta_messages.py:588
Method
test_fallback_credit_usage_propagated
(self, respx_mock: MockRouter)
tests/lib/streaming/test_beta_messages.py:841
Method
test_fallback_on_overloaded_error
(self, respx_mock: MockRouter)
tests/test_middleware.py:709
Method
test_fallback_on_overloaded_error
(self, respx_mock: MockRouter)
tests/test_middleware.py:1468
Method
test_fallback_relabels_model
(self, respx_mock: MockRouter)
tests/lib/streaming/test_beta_messages.py:573
Method
test_fallback_relabels_model
(self, respx_mock: MockRouter)
tests/lib/streaming/test_beta_messages.py:825
Method
test_fallback_retry_sees_identical_request_state
(self, respx_mock: MockRouter)
tests/test_middleware.py:1138
Method
test_fallback_retry_sees_identical_request_state
(self, respx_mock: MockRouter)
tests/test_middleware.py:1663
Method
test_falls_back_to_aws_api_key_env_var
(self, monkeypatch: pytest.MonkeyPatch)
tests/lib/test_bedrock_mantle.py:97
Function
test_family_or_type_named_block_without_toolset_name_is_not_a_member_call
( client: Anthropic, async_client: AsyncAnthropic, respx_mock: MockRouter, flavour: str )
tests/lib/tools/toolsets/test_runner.py:323
← previous
next →
4,701–4,800 of 9,455, ranked by callers