repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import cast from typing_extensions import Protocol import httpx import pytest from respx import MockRouter from anthropic import AnthropicVertex, AsyncAnthropicVertex base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") class TestAnthropic...
"region"
assert
string_literal
tests/lib/test_vertex.py
test_copy
TestAnthropicVertex
57
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import json import inspect from typing import Any, Set, Dict, TypeVar, cast from unittest import TestCase import httpx import pytest from respx import MockRouter from anthropic import Anthropic, AsyncAnthropic from anthropic._compat import PYDANTIC_V1 from anthropic.types...
await stream.get_final_message())
assert_*
func_call
tests/lib/streaming/test_beta_messages.py
test_basic_response
TestAsyncMessages
288
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import Any, cast import pytest import pydantic from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.types.beta import ( BetaMessage, BetaMessageTokensCount, ) base_url = os.environ.get("TEST_API_BA...
"python"
assert
string_literal
tests/api_resources/beta/test_messages.py
test_raw_response_create_overload_1
TestMessages
189
null
anthropics/anthropic-sdk-python
from typing import Any, List, cast import pytest from pydantic import BaseModel from inline_snapshot import external, snapshot from anthropic import Anthropic, AsyncAnthropic, _compat class TestAsyncStream: @pytest.mark.parametrize( "http_snapshot", [ cast(Any, external("uuid:a8b7dbb8...
snapshot("[12345,67890]")
assert
func_call
tests/lib/_parse/test_messages.py
test_stream_with_raw_schema
TestAsyncStream
169
null
anthropics/anthropic-sdk-python
import operator from typing import Any from typing_extensions import override from anthropic._utils import LazyProxy def test_recursive_proxy() -> None: proxy = RecursiveLazyProxy() assert repr(proxy) ==
"RecursiveLazyProxy"
assert
string_literal
tests/test_utils/test_proxy.py
test_recursive_proxy
19
null
anthropics/anthropic-sdk-python
from copy import deepcopy import pytest from inline_snapshot import snapshot from anthropic.lib._parse._transform import transform_schema def test_integer_schema_with_min_max_exclusive(): schema = { "type": "integer", "minimum": 1, "maximum": 10, "exclusiveMinimum": 0, "ex...
snapshot( { "type": "integer", "description": """\ A number {minimum: 1, maximum: 10, exclusiveMinimum: 0, exclusiveMaximum: 20}\ """, } )
assert
func_call
tests/lib/_parse/test_transform.py
test_integer_schema_with_min_max_exclusive
145
null
anthropics/anthropic-sdk-python
import json import logging from typing import Any, Dict, List, Union, cast from typing_extensions import Literal import pytest from inline_snapshot import external, snapshot from anthropic import Anthropic, AsyncAnthropic, beta_tool, beta_async_tool from anthropic._utils import assert_signatures_in_sync from anthropi...
content_types
assert
variable
tests/lib/tools/test_runners.py
test_server_side_tool
TestSyncRunTools
594
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import Any, cast import pytest from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.pagination import SyncPage, AsyncPage from anthropic.types.beta import BetaModelInfo base_url = os.environ.get("TEST_API_...
True
assert
bool_literal
tests/api_resources/beta/test_models.py
test_raw_response_retrieve
TestModels
42
null
anthropics/anthropic-sdk-python
import json import warnings import httpx import pytest from respx import MockRouter from pydantic import BaseModel from anthropic import Anthropic, AnthropicError, AsyncAnthropic, _compat class TestOutputFormatConversion: def test_create_converts_output_format_to_output_config(self, client: Anthropic, respx_moc...
body
assert
variable
tests/api_resources/beta/test_output_format_conversion.py
test_create_converts_output_format_to_output_config
TestOutputFormatConversion
47
null
anthropics/anthropic-sdk-python
import json from typing import Any, Union, cast from typing_extensions import Annotated import httpx import pytest import pydantic from anthropic import Anthropic, BaseModel from anthropic._streaming import Stream from anthropic._base_client import FinalRequestOptions from anthropic._legacy_response import LegacyAPIR...
"my-req-id"
assert
string_literal
tests/test_legacy_response.py
test_response_basemodel_request_id
108
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import Any, cast import pytest from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.pagination import SyncPage, AsyncPage from anthropic.types.beta import BetaModelInfo base_url = os.environ.get("TEST_API_...
model)
assert_*
variable
tests/api_resources/beta/test_models.py
test_raw_response_retrieve
TestModels
45
null
anthropics/anthropic-sdk-python
from typing import Any, cast from functools import partial from urllib.parse import unquote import pytest from anthropic._qs import Querystring, stringify @pytest.mark.parametrize("method", ["class", "function"]) def test_array_comma(method: str) -> None: if method == "class": serialise = Querystring(arr...
"in=foo,bar"
assert
string_literal
tests/test_qs.py
test_array_comma
52
null
anthropics/anthropic-sdk-python
from typing import Any, cast from functools import partial from urllib.parse import unquote import pytest from anthropic._qs import Querystring, stringify def test_basic() -> None: assert stringify({"a": 1}) == "a=1" assert stringify({"a": "b"}) == "a=b" assert stringify({"a": True}) ==
"a=true"
assert
string_literal
tests/test_qs.py
test_basic
19
null
anthropics/anthropic-sdk-python
from __future__ import annotations import pytest from anthropic._exceptions import AnthropicError from anthropic.lib.foundry import AnthropicFoundry, AsyncAnthropicFoundry class TestAnthropicFoundry: def test_initialization_with_azure_ad_token_provider(self) -> None: """Test client initialization with A...
"test-token"
assert
string_literal
tests/lib/test_azure.py
test_initialization_with_azure_ad_token_provider
TestAnthropicFoundry
41
null
anthropics/anthropic-sdk-python
from __future__ import annotations import pytest from anthropic._exceptions import AnthropicError from anthropic.lib.foundry import AnthropicFoundry, AsyncAnthropicFoundry class TestAsyncAnthropicFoundry: @pytest.mark.asyncio async def test_async_azure_ad_token_provider(self) -> None: """Test async ...
"async-test-token"
assert
string_literal
tests/lib/test_azure.py
test_async_azure_ad_token_provider
TestAsyncAnthropicFoundry
94
null
anthropics/anthropic-sdk-python
from __future__ import annotations import pytest from anthropic._exceptions import AnthropicError from anthropic.lib.foundry import AnthropicFoundry, AsyncAnthropicFoundry class TestAnthropicFoundry: def test_initialization_from_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: """Te...
str(client.base_url)
assert
func_call
tests/lib/test_azure.py
test_initialization_from_environment_variables
TestAnthropicFoundry
52
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Sequence import pytest from anthropic._types import FileTypes from anthropic._utils import extract_files def test_removes_files_from_input() -> None: query = {"foo": "bar"} assert extract_files(query, paths=[]) == [] assert query == {"foo": "bar"} ...
{"hello": "world"}
assert
collection
tests/test_extract_files.py
test_removes_files_from_input
18
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import cast from typing_extensions import Protocol import httpx import pytest from respx import MockRouter from anthropic import AnthropicVertex, AsyncAnthropicVertex base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") class TestAnthropic...
"bar"
assert
string_literal
tests/lib/test_vertex.py
test_copy_default_headers
TestAnthropicVertex
92
null
anthropics/anthropic-sdk-python
import json from typing import Any, List, Union, cast from typing_extensions import Annotated import httpx import pytest import pydantic from anthropic import Anthropic, BaseModel, AsyncAnthropic from anthropic._response import ( APIResponse, BaseAPIResponse, AsyncAPIResponse, BinaryAPIResponse, A...
int
assert
variable
tests/test_response.py
test_response_parse_custom_stream
105
null
anthropics/anthropic-sdk-python
from typing import Type, Union from datetime import date, datetime, timezone, timedelta import pytest from anthropic._utils import parse_date, parse_datetime def create_tz(minutes: int) -> timezone: return timezone(timedelta(minutes=minutes)) @pytest.mark.parametrize( "value,result", [ # Valid i...
result
assert
variable
tests/test_utils/test_datetime_parse.py
test_date_parsing
58
null
anthropics/anthropic-sdk-python
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import Base64FileInput, omit, not_given from an...
{"foo": None}
assert
collection
tests/test_transform.py
test_iso8601_format
200
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import Any, cast import pytest import pydantic from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.types.beta import ( BetaMessage, BetaMessageTokensCount, ) base_url = os.environ.get("TEST_API_BA...
message)
assert_*
variable
tests/api_resources/beta/test_messages.py
test_raw_response_create_overload_1
TestMessages
191
null
anthropics/anthropic-sdk-python
import json import warnings import httpx import pytest from respx import MockRouter from pydantic import BaseModel from anthropic import Anthropic, AnthropicError, AsyncAnthropic, _compat class TestOutputFormatConversion: def test_create_converts_output_format_to_output_config(self, client: Anthropic, respx_moc...
"object"
assert
string_literal
tests/api_resources/beta/test_output_format_conversion.py
test_create_converts_output_format_to_output_config
TestOutputFormatConversion
50
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Any, cast import pytest from pydantic import BaseModel from anthropic import beta_tool from anthropic._compat import PYDANTIC_V1 from anthropic.lib.tools._beta_functions import BaseFunctionTool from anthropic.types.beta.beta_tool_param import InputSchema class T...
"Custom description"
assert
string_literal
tests/lib/tools/test_functions.py
test_custom_name_and_description
TestFunctionTool
131
null
anthropics/anthropic-sdk-python
from __future__ import annotations import pytest from anthropic._utils import required_args def test_multiple_variants() -> None: @required_args(["a"], ["b"]) def foo(*, a: str | None = None, b: str | None = None) -> str | None: return a if a is not None else b assert foo(a="foo") == "foo" ...
"bar"
assert
string_literal
tests/test_required_args.py
test_multiple_variants
77
null
anthropics/anthropic-sdk-python
import json from typing import Any, List, Union, cast from typing_extensions import Annotated import httpx import pytest import pydantic from anthropic import Anthropic, BaseModel, AsyncAnthropic from anthropic._response import ( APIResponse, BaseAPIResponse, AsyncAPIResponse, BinaryAPIResponse, A...
str
assert
variable
tests/test_response.py
test_extract_response_type_direct_classes
32
null
anthropics/anthropic-sdk-python
import copy from typing import List, cast import httpx from anthropic.types.beta import BetaDirectCaller, BetaToolUseBlock, BetaInputJSONDelta, BetaRawContentBlockDeltaEvent from anthropic.types.tool_use_block import ToolUseBlock from anthropic.types.beta.beta_usage import BetaUsage from anthropic.lib.streaming._beta...
{"key": "value"}
assert
collection
tests/lib/streaming/test_partial_json.py
test_trailing_strings_mode_header
TestPartialJson
56
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Sequence import pytest from anthropic._types import FileTypes from anthropic._utils import extract_files def test_removes_files_from_input() -> None: query = {"foo": "bar"} assert extract_files(query, paths=[]) == [] assert query == {"foo": "bar"} ...
[("foo[bar]", b"Bar")]
assert
collection
tests/test_extract_files.py
test_removes_files_from_input
25
null
anthropics/anthropic-sdk-python
from __future__ import annotations import pytest from anthropic._exceptions import AnthropicError from anthropic.lib.foundry import AnthropicFoundry, AsyncAnthropicFoundry class TestAnthropicFoundry: def test_missing_resource_error(self) -> None: """Test error raised when neither resource nor base_url i...
ValueError, match="base_url.*resource")
pytest.raises
complex_expr
tests/lib/test_azure.py
test_missing_resource_error
TestAnthropicFoundry
63
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Iterator, AsyncIterator import httpx import pytest from anthropic import Anthropic, AsyncAnthropic from anthropic._streaming import Stream, AsyncStream, ServerSentEvent @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) a...
"ping"
assert
string_literal
tests/test_streaming.py
test_event_missing_data
55
null
anthropics/anthropic-sdk-python
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import Base64FileInput, omit, not_given from an...
data
assert
variable
tests/test_transform.py
test_transform_skipping
442
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import Any, cast import pytest from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.pagination import SyncPageCursor, AsyncPageCursor from anthropic.types.beta.skills import ( VersionListResponse, V...
version)
assert_*
variable
tests/api_resources/beta/skills/test_versions.py
test_raw_response_create
TestVersions
54
null
anthropics/anthropic-sdk-python
import copy from typing import List, cast import httpx from anthropic.types.beta import BetaDirectCaller, BetaToolUseBlock, BetaInputJSONDelta, BetaRawContentBlockDeltaEvent from anthropic.types.tool_use_block import ToolUseBlock from anthropic.types.beta.beta_usage import BetaUsage from anthropic.lib.streaming._beta...
standard_input
assert
variable
tests/lib/streaming/test_partial_json.py
test_trailing_strings_mode_header
TestPartialJson
101
null
anthropics/anthropic-sdk-python
from anthropic._utils import deepcopy_minimal def assert_different_identities(obj1: object, obj2: object) -> None: assert obj1 == obj2 assert id(obj1) != id(obj2) def test_complex_nested_dict() -> None: obj1 = {"foo": {"bar": [{"hello": "world"}]}} obj2 = deepcopy_minimal(obj1) assert_different_id...
obj2["foo"]["bar"])
assert_*
complex_expr
tests/test_deepcopy.py
test_complex_nested_dict
27
null
anthropics/anthropic-sdk-python
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import Base64FileInput, omit, not_given from an...
{}
assert
collection
tests/test_transform.py
test_pydantic_empty_model
285
null
anthropics/anthropic-sdk-python
from typing import Any, cast from functools import partial from urllib.parse import unquote import pytest from anthropic._qs import Querystring, stringify @pytest.mark.parametrize("method", ["class", "function"]) def test_array_comma(method: str) -> None: if method == "class": serialise = Querystring(arr...
"a[b]=true,false"
assert
string_literal
tests/test_qs.py
test_array_comma
53
null
anthropics/anthropic-sdk-python
from __future__ import annotations import json import base64 from typing import Any from unittest.mock import AsyncMock import anyio import pytest mcp = pytest.importorskip("mcp") from mcp.types import ( # noqa: E402 Tool, TextContent, AudioContent, ImageContent, ResourceLink, PromptMessage...
"user"
assert
string_literal
tests/lib/tools/test_mcp_tool.py
test_user_message
TestMCPMessage
172
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, Sequence, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type from anthropic._types import Omit, NoneType from anthrop...
value)
assert_*
variable
tests/utils.py
assert_matches_type
129
null
anthropics/anthropic-sdk-python
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import Base64FileInput, omit, not_given from an...
{"foo": "hi!"}
assert
collection
tests/test_transform.py
test_pydantic_model_to_dictionary
278
null
anthropics/anthropic-sdk-python
from typing import Any, cast from functools import partial from urllib.parse import unquote import pytest from anthropic._qs import Querystring, stringify def test_nested_brackets() -> None: assert unquote(stringify({"a": {"b": "c"}})) == "a[b]=c" assert unquote(stringify({"a": {"b": "c", "d": "e", "f": "g"}...
"a[b]=true"
assert
string_literal
tests/test_qs.py
test_nested_brackets
42
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Any, Iterator, AsyncIterator from typing_extensions import TypeVar import httpx import pytest from anthropic._decoders.jsonl import JSONLDecoder, AsyncJSONLDecoder _T = TypeVar("_T") @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["syn...
{"bar": False}
assert
collection
tests/decoders/test_jsonl.py
test_basic
28
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Sequence import pytest from anthropic._types import FileTypes from anthropic._utils import extract_files def test_removes_files_from_input() -> None: query = {"foo": "bar"} assert extract_files(query, paths=[]) == [] assert query == {"foo": "bar"} ...
[("foo", b"Bar")]
assert
collection
tests/test_extract_files.py
test_removes_files_from_input
17
null
anthropics/anthropic-sdk-python
import re import typing as t import tempfile from typing import TypedDict, cast from typing_extensions import Protocol import httpx import pytest from respx import MockRouter from anthropic import AnthropicBedrock, AsyncAnthropicBedrock sync_client = AnthropicBedrock( aws_region="us-east-1", aws_access_key="...
2
assert
numeric_literal
tests/lib/test_bedrock.py
test_messages_retries
87
null
anthropics/anthropic-sdk-python
import json from typing import Any, List, Union, cast from typing_extensions import Annotated import httpx import pytest import pydantic from anthropic import Anthropic, BaseModel, AsyncAnthropic from anthropic._response import ( APIResponse, BaseAPIResponse, AsyncAPIResponse, BinaryAPIResponse, A...
"foo"
assert
string_literal
tests/test_response.py
test_response_parse_expect_model_union_non_json_content
301
null
anthropics/anthropic-sdk-python
from typing import Any, List, cast import pytest from pydantic import BaseModel from inline_snapshot import external, snapshot from anthropic import Anthropic, AsyncAnthropic, _compat class TestAsyncStream: @pytest.mark.parametrize( "http_snapshot", [ cast(Any, external("uuid:a8b7dbb8...
"text"
assert
string_literal
tests/lib/_parse/test_messages.py
test_stream_with_raw_schema
TestAsyncStream
168
null
anthropics/anthropic-sdk-python
from typing import Any, cast from functools import partial from urllib.parse import unquote import pytest from anthropic._qs import Querystring, stringify @pytest.mark.parametrize("method", ["class", "function"]) def test_nested_dotted(method: str) -> None: if method == "class": serialise = Querystring(n...
"a.b=true"
assert
string_literal
tests/test_qs.py
test_nested_dotted
35
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import Any, cast import pytest from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.types import ModelInfo from anthropic.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL"...
True
assert
bool_literal
tests/api_resources/test_models.py
test_raw_response_retrieve
TestModels
42
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Any, Iterator, AsyncIterator from typing_extensions import TypeVar import httpx import pytest from anthropic._decoders.jsonl import JSONLDecoder, AsyncJSONLDecoder _T = TypeVar("_T") @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["syn...
iterator)
assert_*
variable
tests/decoders/test_jsonl.py
test_basic
30
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import cast from typing_extensions import Protocol import httpx import pytest from respx import MockRouter from anthropic import AnthropicVertex, AsyncAnthropicVertex base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") class TestAnthropic...
7
assert
numeric_literal
tests/lib/test_vertex.py
test_copy_default_options
TestAnthropicVertex
71
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import json from typing import Any, cast import httpx import pytest from respx import MockRouter from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.pagination import SyncPage, AsyncPage from anthropic.types.beta.mess...
True
assert
bool_literal
tests/api_resources/beta/messages/test_batches.py
test_raw_response_create
TestBatches
213
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import Any, cast import pytest from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.pagination import SyncPageCursor, AsyncPageCursor from anthropic.types.beta import ( SkillListResponse, SkillCreat...
True
assert
bool_literal
tests/api_resources/beta/test_skills.py
test_raw_response_create
TestSkills
47
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Sequence import pytest from anthropic._types import FileTypes from anthropic._utils import extract_files def test_removes_files_from_input() -> None: query = {"foo": "bar"} assert extract_files(query, paths=[]) ==
[]
assert
collection
tests/test_extract_files.py
test_removes_files_from_input
13
null
anthropics/anthropic-sdk-python
import json from typing import Any, List, Union, cast from typing_extensions import Annotated import httpx import pytest import pydantic from anthropic import Anthropic, BaseModel, AsyncAnthropic from anthropic._response import ( APIResponse, BaseAPIResponse, AsyncAPIResponse, BinaryAPIResponse, A...
2
assert
numeric_literal
tests/test_response.py
test_response_parse_custom_model
140
null
anthropics/anthropic-sdk-python
import json from typing import Any, Union, cast from typing_extensions import Annotated import httpx import pytest import pydantic from anthropic import Anthropic, BaseModel from anthropic._streaming import Stream from anthropic._base_client import FinalRequestOptions from anthropic._legacy_response import LegacyAPIR...
expected
assert
variable
tests/test_legacy_response.py
test_response_parse_bool
57
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Any, cast import pytest from pydantic import BaseModel from anthropic import beta_tool from anthropic._compat import PYDANTIC_V1 from anthropic.lib.tools._beta_functions import BaseFunctionTool from anthropic.types.beta.beta_tool_param import InputSchema class T...
{}
assert
collection
tests/lib/tools/test_functions.py
test_docstring_parsing_simple
TestFunctionTool
429
null
anthropics/anthropic-sdk-python
import json from typing import Any, Union, cast from typing_extensions import Annotated import httpx import pytest import pydantic from anthropic import Anthropic, BaseModel from anthropic._streaming import Stream from anthropic._base_client import FinalRequestOptions from anthropic._legacy_response import LegacyAPIR...
int
assert
variable
tests/test_legacy_response.py
test_response_parse_custom_stream
71
null
anthropics/anthropic-sdk-python
from typing import Any, cast from functools import partial from urllib.parse import unquote import pytest from anthropic._qs import Querystring, stringify def test_basic() -> None: assert stringify({"a": 1}) == "a=1" assert stringify({"a": "b"}) == "a=b" assert stringify({"a": True}) == "a=true" ass...
"a=false"
assert
string_literal
tests/test_qs.py
test_basic
20
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Iterator, AsyncIterator import httpx import pytest from anthropic import Anthropic, AsyncAnthropic from anthropic._streaming import Stream, AsyncStream, ServerSentEvent @pytest.mark.asyncio @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) a...
None
assert
none_literal
tests/test_streaming.py
test_data_missing_event
39
null
anthropics/anthropic-sdk-python
import json from typing import Any, cast import pytest from pydantic import BaseModel from inline_snapshot import external, snapshot from anthropic import AnthropicError, AsyncAnthropic, _compat from anthropic.types.beta.parsed_beta_message import ParsedBetaMessage class TestAsyncMessages: @pytest.mark.parametri...
"text"
assert
string_literal
tests/lib/_parse/test_beta_messages.py
test_stream_with_raw_schema
TestAsyncMessages
45
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import inspect from typing import Any, Set, TypeVar, cast import httpx import pytest from respx import MockRouter from anthropic import Stream, Anthropic, AsyncStream, AsyncAnthropic from anthropic._compat import PYDANTIC_V1 from anthropic.lib.streaming import ParsedMessa...
1
assert
numeric_literal
tests/lib/streaming/test_messages.py
assert_basic_response
36
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import Any, cast import pytest from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.types import Completion base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") class TestCompletions: ...
completion)
assert_*
variable
tests/api_resources/test_completions.py
test_raw_response_create_overload_1
TestCompletions
56
null
anthropics/anthropic-sdk-python
from typing import Type, Union from datetime import date, datetime, timezone, timedelta import pytest from anthropic._utils import parse_date, parse_datetime def create_tz(minutes: int) -> timezone: return timezone(timedelta(minutes=minutes)) @pytest.mark.parametrize( "value,result", [ # Valid i...
result)
pytest.raises
variable
tests/test_utils/test_datetime_parse.py
test_date_parsing
55
null
anthropics/anthropic-sdk-python
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import Base64FileInput, omit, not_given from an...
None
assert
none_literal
tests/test_transform.py
test_pydantic_default_field
343
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import inspect from typing import Any, Set, TypeVar, cast import httpx import pytest from respx import MockRouter from anthropic import Stream, Anthropic, AsyncStream, AsyncAnthropic from anthropic._compat import PYDANTIC_V1 from anthropic.lib.streaming import ParsedMessa...
"text"
assert
string_literal
tests/lib/streaming/test_messages.py
assert_basic_response
39
null
anthropics/anthropic-sdk-python
from __future__ import annotations import pytest from anthropic._utils import required_args def test_positional_param() -> None: @required_args(["a"]) def foo(a: str | None = None) -> str | None: return a assert foo("a") == "a" assert foo(None) is None assert foo(a="b") ==
"b"
assert
string_literal
tests/test_required_args.py
test_positional_param
24
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import inspect from typing import Any, Set, TypeVar, cast import httpx import pytest from respx import MockRouter from anthropic import Stream, Anthropic, AsyncStream, AsyncAnthropic from anthropic._compat import PYDANTIC_V1 from anthropic.lib.streaming import ParsedMessa...
2
assert
numeric_literal
tests/lib/streaming/test_messages.py
assert_tool_use_response
63
null
anthropics/anthropic-sdk-python
from __future__ import annotations import pytest from anthropic._exceptions import AnthropicError from anthropic.lib.foundry import AnthropicFoundry, AsyncAnthropicFoundry class TestAnthropicFoundry: def test_initialization_from_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: """Te...
"env-key"
assert
string_literal
tests/lib/test_azure.py
test_initialization_from_environment_variables
TestAnthropicFoundry
51
null
anthropics/anthropic-sdk-python
from __future__ import annotations import gc import os import sys import json import asyncio import inspect import dataclasses import tracemalloc from typing import Any, Union, TypeVar, Callable, Iterable, Iterator, Optional, Coroutine, cast from unittest import mock from typing_extensions import Literal, AsyncIterato...
7
assert
numeric_literal
tests/test_client.py
test_copy_default_options
TestAnthropic
147
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Generic, TypeVar, cast from anthropic._utils import extract_type_var_from_base _T = TypeVar("_T") _T2 = TypeVar("_T2") _T3 = TypeVar("_T3") def test_extract_type_var() -> None: assert
int
assert
variable
tests/test_utils/test_typing.py
test_extract_type_var
28
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import inspect from typing import Any, Set, TypeVar, cast import httpx import pytest from respx import MockRouter from anthropic import Stream, Anthropic, AsyncStream, AsyncAnthropic from anthropic._compat import PYDANTIC_V1 from anthropic.lib.streaming import ParsedMessa...
"end_turn"
assert
string_literal
tests/lib/streaming/test_messages.py
assert_basic_response
33
null
anthropics/anthropic-sdk-python
from typing import Any, cast from functools import partial from urllib.parse import unquote import pytest from anthropic._qs import Querystring, stringify def test_basic() -> None: assert stringify({"a": 1}) == "a=1" assert stringify({"a": "b"}) ==
"a=b"
assert
string_literal
tests/test_qs.py
test_basic
18
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import inspect from typing import Any, Set, TypeVar, cast import httpx import pytest from respx import MockRouter from anthropic import Stream, Anthropic, AsyncStream, AsyncAnthropic from anthropic._compat import PYDANTIC_V1 from anthropic.lib.streaming import ParsedMessa...
stream.get_final_message())
assert_*
func_call
tests/lib/streaming/test_messages.py
test_basic_response
TestSyncMessages
128
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import inspect from typing import Any, Set, TypeVar, cast import httpx import pytest from respx import MockRouter from anthropic import Stream, Anthropic, AsyncStream, AsyncAnthropic from anthropic._compat import PYDANTIC_V1 from anthropic.lib.streaming import ParsedMessa...
"message"
assert
string_literal
tests/lib/streaming/test_messages.py
assert_basic_response
35
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Sequence import pytest from anthropic._types import FileTypes from anthropic._utils import extract_files @pytest.mark.parametrize( "query,paths,expected", [ [ {"foo": {"bar": "baz"}}, [["foo", "<array>", "bar"]], ...
expected
assert
variable
tests/test_extract_files.py
test_ignores_incorrect_paths
64
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import Any, cast import pytest from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.pagination import SyncPageCursor, AsyncPageCursor from anthropic.types.beta import ( SkillListResponse, SkillCreat...
skill)
assert_*
variable
tests/api_resources/beta/test_skills.py
test_raw_response_create
TestSkills
50
null
anthropics/anthropic-sdk-python
import re import typing as t import tempfile from typing import TypedDict, cast from typing_extensions import Protocol import httpx import pytest from respx import MockRouter from anthropic import AnthropicBedrock, AsyncAnthropicBedrock sync_client = AnthropicBedrock( aws_region="us-east-1", aws_access_key="...
next(profile for profile in profiles if profile["name"] == aws_profile)["region"]
assert
func_call
tests/lib/test_bedrock.py
test_region_infer_from_specified_profile
197
null
anthropics/anthropic-sdk-python
import json from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional, cast from datetime import datetime, timezone from typing_extensions import Literal, Annotated, TypeAliasType import pytest import pydantic from pydantic import Field from anthropic._utils import PropertyInfo from anthropic._compat import ...
3
assert
numeric_literal
tests/test_models.py
test_nested_union_invalid_data
302
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import Any, cast import pytest from anthropic import Anthropic, AsyncAnthropic from tests.utils import assert_matches_type from anthropic.types import Completion base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") class TestCompletions: ...
"python"
assert
string_literal
tests/api_resources/test_completions.py
test_raw_response_create_overload_1
TestCompletions
54
null
anthropics/anthropic-sdk-python
from __future__ import annotations import gc import os import sys import json import asyncio import inspect import dataclasses import tracemalloc from typing import Any, Union, TypeVar, Callable, Iterable, Iterator, Optional, Coroutine, cast from unittest import mock from typing_extensions import Literal, AsyncIterato...
2
assert
numeric_literal
tests/test_client.py
test_copy_default_options
TestAnthropic
148
null
anthropics/anthropic-sdk-python
from typing import Any, cast from functools import partial from urllib.parse import unquote import pytest from anthropic._qs import Querystring, stringify def test_nested_brackets() -> None: assert unquote(stringify({"a": {"b": "c"}})) == "a[b]=c" assert unquote(stringify({"a": {"b": "c", "d": "e", "f": "g"}...
"a[b][c][d]=e"
assert
string_literal
tests/test_qs.py
test_nested_brackets
41
null
anthropics/anthropic-sdk-python
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import Base64FileInput, omit, not_given from an...
{"FOO": "bar"}
assert
collection
tests/test_transform.py
test_iterable_union_str
407
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os from typing import cast from typing_extensions import Protocol import httpx import pytest from respx import MockRouter from anthropic import AnthropicVertex, AsyncAnthropicVertex base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") class TestAnthropic...
None
assert
none_literal
tests/lib/test_vertex.py
test_copy_default_headers
TestAnthropicVertex
111
null
anthropics/anthropic-sdk-python
from __future__ import annotations import json import base64 from typing import Any from unittest.mock import AsyncMock import anyio import pytest mcp = pytest.importorskip("mcp") from mcp.types import ( # noqa: E402 Tool, TextContent, AudioContent, ImageContent, ResourceLink, PromptMessage...
1
assert
numeric_literal
tests/lib/tools/test_mcp_tool.py
test_user_message
TestMCPMessage
174
null
anthropics/anthropic-sdk-python
import json import logging from typing import Any, Dict, List, Union, cast from typing_extensions import Literal import pytest from inline_snapshot import external, snapshot from anthropic import Anthropic, AsyncAnthropic, beta_tool, beta_async_tool from anthropic._utils import assert_signatures_in_sync from anthropi...
snapshots["basic"]["result"]
assert
complex_expr
tests/lib/tools/test_runners.py
test_basic_call_sync
TestSyncRunTools
161
null
anthropics/anthropic-sdk-python
import json from typing import Any, cast import pytest from pydantic import BaseModel from inline_snapshot import external, snapshot from anthropic import AnthropicError, AsyncAnthropic, _compat from anthropic.types.beta.parsed_beta_message import ParsedBetaMessage class TestAsyncMessages: @pytest.mark.parametri...
snapshot("[12345,67890]")
assert
func_call
tests/lib/_parse/test_beta_messages.py
test_stream_with_raw_schema
TestAsyncMessages
46
null
anthropics/anthropic-sdk-python
from __future__ import annotations import pytest from anthropic._exceptions import AnthropicError from anthropic.lib.foundry import AnthropicFoundry, AsyncAnthropicFoundry class TestAnthropicFoundry: def test_initialization_with_azure_ad_token_provider(self) -> None: """Test client initialization with A...
None
assert
none_literal
tests/lib/test_azure.py
test_initialization_with_azure_ad_token_provider
TestAnthropicFoundry
40
null
anthropics/anthropic-sdk-python
from __future__ import annotations import io import pathlib from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest from anthropic._types import Base64FileInput, omit, not_given from an...
[1, 2, 3]
assert
collection
tests/test_transform.py
test_transform_skipping
446
null
anthropics/anthropic-sdk-python
from __future__ import annotations import gc import os import sys import json import asyncio import inspect import dataclasses import tracemalloc from typing import Any, Union, TypeVar, Callable, Iterable, Iterator, Optional, Coroutine, cast from unittest import mock from typing_extensions import Literal, AsyncIterato...
1
assert
numeric_literal
tests/test_client.py
test_union_response_different_types
TestAnthropic
664
null
anthropics/anthropic-sdk-python
from __future__ import annotations import pytest from anthropic._utils import required_args def test_positional_param() -> None: @required_args(["a"]) def foo(a: str | None = None) -> str | None: return a assert foo("a") ==
"a"
assert
string_literal
tests/test_required_args.py
test_positional_param
22
null
anthropics/anthropic-sdk-python
from typing import Any, cast from functools import partial from urllib.parse import unquote import pytest from anthropic._qs import Querystring, stringify @pytest.mark.parametrize("method", ["class", "function"]) def test_nested_dotted(method: str) -> None: if method == "class": serialise = Querystring(n...
"a.b=c"
assert
string_literal
tests/test_qs.py
test_nested_dotted
32
null
anthropics/anthropic-sdk-python
import json from typing import Any, Union, cast from typing_extensions import Annotated import httpx import pytest import pydantic from anthropic import Anthropic, BaseModel from anthropic._streaming import Stream from anthropic._base_client import FinalRequestOptions from anthropic._legacy_response import LegacyAPIR...
"hello!"
assert
string_literal
tests/test_legacy_response.py
test_response_parse_custom_model
90
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Any, cast import pytest from pydantic import BaseModel from anthropic import beta_tool from anthropic._compat import PYDANTIC_V1 from anthropic.lib.tools._beta_functions import BaseFunctionTool from anthropic.types.beta.beta_tool_param import InputSchema class T...
"custom_name"
assert
string_literal
tests/lib/tools/test_functions.py
test_custom_name_and_description
TestFunctionTool
130
null
anthropics/anthropic-sdk-python
from __future__ import annotations import json import base64 from typing import Any from unittest.mock import AsyncMock import anyio import pytest mcp = pytest.importorskip("mcp") from mcp.types import ( # noqa: E402 Tool, TextContent, AudioContent, ImageContent, ResourceLink, PromptMessage...
"42"
assert
string_literal
tests/lib/tools/test_mcp_tool.py
_test
TestAsyncMCPToolCall
337
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, Sequence, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type from anthropic._types import Omit, NoneType from anthrop...
field_value)
assert_*
variable
tests/utils.py
assert_matches_model
38
null
anthropics/anthropic-sdk-python
from __future__ import annotations import os import inspect import traceback import contextlib from typing import Any, TypeVar, Iterator, Sequence, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type from anthropic._types import Omit, NoneType from anthrop...
item)
assert_*
variable
tests/utils.py
assert_matches_type
110
null
anthropics/anthropic-sdk-python
from __future__ import annotations from typing import Any, cast import pytest from pydantic import BaseModel from anthropic import beta_tool from anthropic._compat import PYDANTIC_V1 from anthropic.lib.tools._beta_functions import BaseFunctionTool from anthropic.types.beta.beta_tool_param import InputSchema class T...
"5.0"
assert
string_literal
tests/lib/tools/test_functions.py
test_decorator_with_parentheses
TestFunctionTool
405
null
anthropics/anthropic-sdk-python
from pathlib import Path import anyio import pytest from dirty_equals import IsDict, IsList, IsBytes, IsTuple from anthropic._files import to_httpx_files, async_to_httpx_files readme_path = Path(__file__).parent.parent.joinpath("README.md") def test_tuple_input() -> None: result = to_httpx_files([("file", readm...
IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
assert
func_call
tests/test_files.py
test_tuple_input
21
null
python-poetry/poetry-core
from __future__ import annotations from typing import TYPE_CHECKING import pytest from poetry.core.constraints.generic import AnyConstraint from poetry.core.constraints.generic import Constraint from poetry.core.constraints.generic import EmptyConstraint from poetry.core.constraints.generic import MultiConstraint fr...
c
assert
variable
tests/constraints/generic/test_constraint.py
test_difference
1,626
null
python-poetry/poetry-core
from __future__ import annotations import sys from pathlib import Path import pytest from poetry.core.packages.utils.utils import path_to_url from poetry.core.packages.utils.utils import url_to_path @pytest.mark.skipif("sys.platform == 'win32'") def test_path_to_url_unix() -> None: assert path_to_url("/tmp/fi...
"file:///tmp/file"
assert
string_literal
tests/packages/utils/test_utils_urls.py
test_path_to_url_unix
18
null
python-poetry/poetry-core
from __future__ import annotations import pytest from poetry.core.spdx.helpers import _load_licenses from poetry.core.spdx.helpers import license_by_id def test_license_by_id() -> None: license = license_by_id("MIT") assert license.id == "MIT" assert license.name ==
"MIT License"
assert
string_literal
tests/spdx/test_helpers.py
test_license_by_id
13
null