repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/streaming/test_messages.py | assert_basic_response | assert | string_literal | 39 | 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_V2
from anthropic.lib.streaming import MessageStre... | "text" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/streaming/test_messages.py | assert_basic_response | assert | string_literal | 35 | 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_V2
from anthropic.lib.streaming import MessageStre... | "message" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/streaming/test_messages.py | assert_basic_response | assert | string_literal | 33 | 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_V2
from anthropic.lib.streaming import MessageStre... | "end_turn" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/streaming/test_messages.py | test_tracks_tool_input_type_alias_is_up_to_date | assert | variable | 133 | 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_V2
from anthropic.lib.streaming import MessageStre... | tracked_types | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/streaming/test_messages.py | test_basic_response | assert_* | func_call | 126 | 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_V2
from anthropic.lib.streaming import MessageStre... | stream.get_final_message()) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/streaming/test_messages.py | test_basic_response | assert_* | func_call | 127 | 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_V2
from anthropic.lib.streaming import MessageStre... | await stream.get_final_message()) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/streaming/test_partial_json.py | test_trailing_strings_mode_header | assert | variable | 95 | import copy
from typing import List, cast
import httpx
from anthropic.types.tool_use_block import ToolUseBlock
from anthropic.types.beta.beta_usage import BetaUsage
from anthropic.types.beta.beta_message import BetaMessage
from anthropic.lib.streaming._beta_messages import accumulate_event
from anthropic.types.beta.b... | standard_input | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/streaming/test_partial_json.py | test_trailing_strings_mode_header | assert | variable | 98 | import copy
from typing import List, cast
import httpx
from anthropic.types.tool_use_block import ToolUseBlock
from anthropic.types.beta.beta_usage import BetaUsage
from anthropic.types.beta.beta_message import BetaMessage
from anthropic.lib.streaming._beta_messages import accumulate_event
from anthropic.types.beta.b... | trailing_input | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/streaming/test_partial_json.py | test_trailing_strings_mode_header | assert | collection | 50 | import copy
from typing import List, cast
import httpx
from anthropic.types.tool_use_block import ToolUseBlock
from anthropic.types.beta.beta_usage import BetaUsage
from anthropic.types.beta.beta_message import BetaMessage
from anthropic.lib.streaming._beta_messages import accumulate_event
from anthropic.types.beta.b... | {"key": "value"} | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/streaming/test_partial_json.py | test_trailing_strings_mode_header | assert | collection | 90 | import copy
from typing import List, cast
import httpx
from anthropic.types.tool_use_block import ToolUseBlock
from anthropic.types.beta.beta_usage import BetaUsage
from anthropic.types.beta.beta_message import BetaMessage
from anthropic.lib.streaming._beta_messages import accumulate_event
from anthropic.types.beta.b... | ["item1", "item2"] | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_bedrock.py | test_messages_retries | assert | numeric_literal | 72 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_bedrock.py | test_region_infer_from_profile | assert | complex_expr | 54 | 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="... | profiles[0]["region"] | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_bedrock.py | test_region_infer_from_specified_profile | assert | func_call | 69 | 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"] | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_bedrock.py | test_messages_retries | assert | string_literal | 74 | 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="... | "https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-sonnet-20240229-v1:0/invoke" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_bedrock.py | test_application_inference_profile | assert | string_literal | 73 | 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="... | "https://bedrock-runtime.us-east-1.amazonaws.com/model/arn:aws:bedrock:us-east-1:123456789012:application-inference-profile%2Fjf2sje1c0jnb/invoke" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_vertex.py | test_messages_retries | assert | numeric_literal | 42 | 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... | 2 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_vertex.py | test_copy_default_options | assert | numeric_literal | 22 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_vertex.py | test_copy_default_options | assert | numeric_literal | 26 | 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... | 6 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_vertex.py | test_copy_default_headers | assert | none_literal | 46 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_vertex.py | test_copy_default_headers | assert | string_literal | 27 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_vertex.py | test_copy | assert | string_literal | 25 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/lib/test_vertex.py | test_copy | assert | string_literal | 27 | 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... | "project" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_client.py | test_copy_default_options | assert | numeric_literal | 63 | from __future__ import annotations
import gc
import os
import sys
import json
import time
import asyncio
import inspect
import subprocess
import tracemalloc
from typing import Any, Union, cast
from textwrap import dedent
from unittest import mock
from typing_extensions import Literal
import httpx
import pytest
from r... | 7 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_client.py | test_copy_default_options | assert | numeric_literal | 64 | from __future__ import annotations
import gc
import os
import sys
import json
import time
import asyncio
import inspect
import subprocess
import tracemalloc
from typing import Any, Union, cast
from textwrap import dedent
from unittest import mock
from typing_extensions import Literal
import httpx
import pytest
from r... | 2 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_client.py | test_copy_default_options | assert | numeric_literal | 67 | from __future__ import annotations
import gc
import os
import sys
import json
import time
import asyncio
import inspect
import subprocess
import tracemalloc
from typing import Any, Union, cast
from textwrap import dedent
from unittest import mock
from typing_extensions import Literal
import httpx
import pytest
from r... | 6 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_client.py | test_union_response_different_types | assert | numeric_literal | 80 | from __future__ import annotations
import gc
import os
import sys
import json
import time
import asyncio
import inspect
import subprocess
import tracemalloc
from typing import Any, Union, cast
from textwrap import dedent
from unittest import mock
from typing_extensions import Literal
import httpx
import pytest
from r... | 1 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_client.py | test_retrying_timeout_errors_doesnt_leak | assert | numeric_literal | 77 | from __future__ import annotations
import gc
import os
import sys
import json
import time
import asyncio
import inspect
import subprocess
import tracemalloc
from typing import Any, Union, cast
from textwrap import dedent
from unittest import mock
from typing_extensions import Literal
import httpx
import pytest
from r... | 0 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_client.py | test_copy_default_query | assert | collection | 84 | from __future__ import annotations
import gc
import os
import sys
import json
import time
import asyncio
import inspect
import subprocess
import tracemalloc
from typing import Any, Union, cast
from textwrap import dedent
from unittest import mock
from typing_extensions import Literal
import httpx
import pytest
from r... | {} | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_client.py | test_raw_response | assert | numeric_literal | 65 | from __future__ import annotations
import gc
import os
import sys
import json
import time
import asyncio
import inspect
import subprocess
import tracemalloc
from typing import Any, Union, cast
from textwrap import dedent
from unittest import mock
from typing_extensions import Literal
import httpx
import pytest
from r... | 200 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_deepcopy.py | assert_different_identities | assert | variable | 5 | from anthropic._utils import deepcopy_minimal
def assert_different_identities(obj1: object, obj2: object) -> None:
assert obj1 == | obj2 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_deepcopy.py | test_ignores_other_types | assert | variable | 19 | 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_ignores_other_types() -> None:
# custom classes
my_obj = MyObject()
obj1 = {"foo": my_obj}
obj2 = deepcopy_minimal(obj1)
... | obj4 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_deepcopy.py | test_ignores_other_types | assert_* | variable | 13 | 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_ignores_other_types() -> None:
# custom classes
my_obj = MyObject()
obj1 = {"foo": my_obj}
obj2 = deepcopy_minimal(obj1)
... | obj2) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_deepcopy.py | test_ignores_other_types | assert | variable | 14 | 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_ignores_other_types() -> None:
# custom classes
my_obj = MyObject()
obj1 = {"foo": my_obj}
obj2 = deepcopy_minimal(obj1)
... | my_obj | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_deepcopy.py | assert_different_identities | assert | func_call | 6 | from anthropic._utils import deepcopy_minimal
def assert_different_identities(obj1: object, obj2: object) -> None:
assert obj1 == obj2
assert id(obj1) != | id(obj2) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_deepcopy.py | test_nested_list | assert_* | complex_expr | 12 | 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_nested_list() -> None:
obj1 = ["a", [1, 2, 3]]
obj2 = deepcopy_minimal(obj1)
assert_different_identities(obj1, obj2)
asse... | obj2[1]) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_deepcopy.py | test_nested_dict | assert_* | complex_expr | 12 | 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_nested_dict() -> None:
obj1 = {"foo": {"bar": True}}
obj2 = deepcopy_minimal(obj1)
assert_different_identities(obj1, obj2)
... | obj2["foo"]) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_deepcopy.py | test_complex_nested_dict | assert_* | complex_expr | 13 | 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"]) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_deepcopy.py | test_complex_nested_dict | assert_* | complex_expr | 14 | 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"][0]) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_extract_files.py | test_removes_files_from_input | assert | collection | 13 | 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=[]) == | [] | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_extract_files.py | test_ignores_incorrect_paths | assert | variable | 37 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_extract_files.py | test_removes_files_from_input | assert | collection | 14 | 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"} | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_extract_files.py | test_removes_files_from_input | assert | collection | 17 | 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")] | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_extract_files.py | test_removes_files_from_input | assert | collection | 18 | 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"} | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_extract_files.py | test_removes_files_from_input | assert | collection | 25 | 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")] | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_extract_files.py | test_multiple_files | assert | collection | 17 | from __future__ import annotations
from typing import Sequence
import pytest
from anthropic._types import FileTypes
from anthropic._utils import extract_files
def test_multiple_files() -> None:
query = {"documents": [{"file": b"My first file"}, {"file": b"My second file"}]}
assert extract_files(query, paths... | {"documents": [{}, {}]} | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_extract_files.py | test_multiple_files | assert | collection | 13 | from __future__ import annotations
from typing import Sequence
import pytest
from anthropic._types import FileTypes
from anthropic._utils import extract_files
def test_multiple_files() -> None:
query = {"documents": [{"file": b"My first file"}, {"file": b"My second file"}]}
assert extract_files(query, path... | [ ("documents[][file]", b"My first file"), ("documents[][file]", b"My second file"), ] | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_files.py | test_pathlib_includes_file_name | assert | func_call | 15 | 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_pathlib_includes_file_name() -> None:
result = to_httpx_files(... | IsDict({"file": IsTuple("README.md", IsBytes())}) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_files.py | test_tuple_input | assert | func_call | 15 | 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()))) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_files.py | test_string_not_allowed | pytest.raises | complex_expr | 13 | 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_string_not_allowed() -> None:
with pytest.raises( | TypeError, match="Expected file types input to be a FileContent type or to be a tuple") | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_legacy_response.py | test_response_parse_custom_model | assert | numeric_literal | 27 | 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... | 2 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_legacy_response.py | test_response_parse_custom_stream | assert | variable | 26 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_legacy_response.py | test_response_parse_expect_model_union_non_json_content | assert | string_literal | 28 | 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... | "foo" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_legacy_response.py | test_response_parse_bool | assert | variable | 37 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_legacy_response.py | test_response_parse_custom_model | assert | string_literal | 26 | 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!" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_legacy_response.py | test_response_basemodel_request_id | assert | string_literal | 29 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_legacy_response.py | test_response_basemodel_request_id | assert | collection | 32 | 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... | {"foo": "hello!", "bar": 2} | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_legacy_response.py | test_response_parse_mismatched_basemodel | pytest.raises | complex_expr | 25 | 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... | TypeError, match="Pydantic models must subclass our base model type, e.g. `from anthropic import BaseModel`") | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_models.py | test_list_nested_model | assert | numeric_literal | 22 | import json
from typing import 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 PYDANTIC_V2, pa... | 2 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_models.py | test_unknown_fields | assert | numeric_literal | 18 | import json
from typing import 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 PYDANTIC_V2, pa... | 1 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_models.py | test_nested_union_invalid_data | assert | numeric_literal | 31 | import json
from typing import 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 PYDANTIC_V2, pa... | 3 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_models.py | test_optional_list | assert | collection | 26 | import json
from typing import 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 PYDANTIC_V2, pa... | [] | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_empty | assert | string_literal | 11 | from typing import Any, cast
from functools import partial
from urllib.parse import unquote
import pytest
from anthropic._qs import Querystring, stringify
def test_empty() -> None:
assert stringify({}) == | "" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_basic | assert | string_literal | 11 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_basic | assert | string_literal | 12 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_nested_dotted | assert | string_literal | 17 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_basic | assert | string_literal | 13 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_nested_brackets | assert | string_literal | 11 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_basic | assert | string_literal | 14 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_nested_dotted | assert | string_literal | 20 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_nested_dotted | assert | string_literal | 19 | 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.d=e" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_nested_brackets | assert | string_literal | 14 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_array_comma | assert | string_literal | 17 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_nested_brackets | assert | string_literal | 13 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_array_repeat | assert | string_literal | 11 | from typing import Any, cast
from functools import partial
from urllib.parse import unquote
import pytest
from anthropic._qs import Querystring, stringify
def test_array_repeat() -> None:
assert unquote(stringify({"in": ["foo", "bar"]})) == | "in=foo&in=bar" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_array_comma | assert | string_literal | 18 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_nested_dotted | assert | string_literal | 18 | 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&a.d=e&a.f=g" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_array_brackets | assert | string_literal | 17 | 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_brackets(method: str) -> None:
if method == "class":
serialise = Querystring(... | "in[]=foo&in[]=bar" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_qs.py | test_nested_brackets | assert | string_literal | 12 | 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&a[d]=e&a[f]=g" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_required_args.py | test_positional_param | assert | string_literal | 13 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_required_args.py | test_positional_param | assert | string_literal | 15 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_required_args.py | test_positional_param | assert | none_literal | 14 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_required_args.py | test_multiple_variants | assert | string_literal | 13 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_required_args.py | test_multiple_variants | assert | string_literal | 14 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_required_args.py | test_multiple_params | assert | string_literal | 13 | from __future__ import annotations
import pytest
from anthropic._utils import required_args
def test_multiple_params() -> None:
@required_args(["a", "b", "c"])
def foo(a: str = "", *, b: str = "", c: str = "") -> str | None:
return f"{a} {b} {c}"
assert foo(a="a", b="b", c="c") == | "a b c" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_required_args.py | test_multiple_params | pytest.raises | complex_expr | 17 | from __future__ import annotations
import pytest
from anthropic._utils import required_args
def test_multiple_params() -> None:
@required_args(["a", "b", "c"])
def foo(a: str = "", *, b: str = "", c: str = "") -> str | None:
return f"{a} {b} {c}"
assert foo(a="a", b="b", c="c") == "a b c"
e... | TypeError, match=error_message) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_response.py | test_response_parse_custom_model | assert | numeric_literal | 34 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_response.py | test_extract_response_type_direct_classes | assert | variable | 23 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_response.py | test_response_parse_custom_stream | assert | variable | 33 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_response.py | test_extract_response_type_concrete_subclasses | assert | variable | 23 | 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... | bytes | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_response.py | test_response_parse_expect_model_union_non_json_content | assert | string_literal | 35 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_response.py | test_response_parse_custom_model | assert | string_literal | 33 | 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... | "hello!" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_streaming.py | test_event_missing_data | assert | string_literal | 23 | 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... | "" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_streaming.py | test_data_missing_event | assert | none_literal | 22 | 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 | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_streaming.py | test_event_missing_data | assert | string_literal | 22 | 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" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_streaming.py | test_basic | assert_* | variable | 26 | 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... | iterator) | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_transform.py | test_pydantic_empty_model | assert | collection | 39 | 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 NOT_GIVEN, Base64FileInput
from anthropi... | {} | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_transform.py | test_datetime_custom_format | assert | string_literal | 42 | 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 NOT_GIVEN, Base64FileInput
from anthropi... | "06" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_transform.py | test_pydantic_default_field | assert | none_literal | 41 | 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 NOT_GIVEN, Base64FileInput
from anthropi... | None | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_transform.py | test_transform_skipping | assert | variable | 41 | 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 NOT_GIVEN, Base64FileInput
from anthropi... | data | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
anthropics/anthropic-sdk-python | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | train | train | tests/test_transform.py | test_pydantic_default_field | assert | string_literal | 42 | 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 NOT_GIVEN, Base64FileInput
from anthropi... | "foo" | 46e4b98bac8f3f4ae419aa6e9054a30436bad5d1 | 159 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.