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 |
|---|---|---|---|---|---|---|---|---|---|
vkbottle/vkbottle | from vkbottle.tools import Formatter, bold, italic, underline, url
def test_docs_formatter():
f1 = Formatter("{:bold}, nice formatting!").format("Wow")
assert f1.format_data == {
"version": Formatter.VERSION,
"items": [{"type": "bold", "offset": 0, "length": 3}],
}
f2 = Formatter("{fra... | { "version": Formatter.VERSION, "items": [{"type": "italic", "offset": 0, "length": 8}], } | assert | collection | tests/tools/test_formatting.py | test_docs_formatter | 14 | null | |
vkbottle/vkbottle | import json
from typing import Any, Callable
import pytest
import vbml
from vkbottle_types.methods.base_category import BaseCategory
from tests.test_utils import MockedClient, with_mocked_api
from vkbottle import (
API,
AndRule,
BaseStateGroup,
Bot,
GroupEventType,
GroupTypes,
NotRule,
... | "some token" | assert | string_literal | tests/test_bot.py | test_bot_scopes | 160 | null | |
vkbottle/vkbottle | from typing import Any
import pytest
from tests.test_utils import MockedClient
from vkbottle import API
from vkbottle.tools.mini_types.bot.foreign_message import ForeignMessageMin
def fake_foreign_message(ctx_api: API, **data: Any) -> ForeignMessageMin:
message = {
"peer_id": 1,
"date": 1,
... | True | assert | bool_literal | tests/test_foreign_message.py | test_get_full_message | 70 | null | |
vkbottle/vkbottle | import pickle
from vkbottle.exception_factory import CodeException, VKAPIError
def test_code_exception_is_saved_in_module():
assert CodeError[2] is CodeError[2]
assert CodeError[1] is | CodeError1 | assert | variable | tests/test_exceptions.py | test_code_exception_is_saved_in_module | 33 | null | |
vkbottle/vkbottle | import asyncio
from tests.test_bot import fake_message
from tests.test_utils import with_mocked_api
from vkbottle.bot import rules
from vkbottle.dispatch.dispenser.builtin import BuiltinStateDispenser
from vkbottle.dispatch.views.bot.message import BotMessageView
from vkbottle.tools import WaiterMachine
async def sen... | {} | assert | collection | tests/tools/test_waiter_machine.py | test_waiter_machine | 58 | null | |
vkbottle/vkbottle | from vkbottle.tools import Formatter, bold, italic, underline, url
def test_docs_formatter():
f1 = Formatter("{:bold}, nice formatting!").format("Wow")
assert f1.format_data == | { "version": Formatter.VERSION, "items": [{"type": "bold", "offset": 0, "length": 3}], } | assert | collection | tests/tools/test_formatting.py | test_docs_formatter | 6 | null | |
vkbottle/vkbottle | from __future__ import annotations
import asyncio
import os
import re
from io import StringIO
from typing import TYPE_CHECKING
import pytest
from vkbottle import API
from vkbottle.bot import Bot, run_multibot
from vkbottle.dispatch import ABCRule, AndRule, NotRule, OrRule
from vkbottle.exception_factory.base_excepti... | KEYBOARD_JSON | assert | variable | tests/tools/test_tools.py | test_keyboard_non_builder | 95 | null | |
vkbottle/vkbottle | from typing import Any
import pytest
from tests.test_utils import with_mocked_api
from vkbottle import API, ABCRequestRescheduler, APIAuthError, CaptchaError, CtxStorage, VKAPIError
USERS_GET_RESPONSE = (
'{"response":[{"first_name":"Павел","id":1,"last_name":"Дуров",'
'"can_access_closed":true,"is_closed":f... | 5 | assert | numeric_literal | tests/test_api.py | test_auth_blocked_user_error_handling | 85 | null | |
vkbottle/vkbottle | from __future__ import annotations
import asyncio
import os
import re
from io import StringIO
from typing import TYPE_CHECKING
import pytest
from vkbottle import API
from vkbottle.bot import Bot, run_multibot
from vkbottle.dispatch import ABCRule, AndRule, NotRule, OrRule
from vkbottle.exception_factory.base_excepti... | True) | assert_* | bool_literal | tests/tools/test_tools.py | test_utils | 218 | null | |
vkbottle/vkbottle | import json
from typing import Any, Callable
import pytest
import vbml
from vkbottle_types.methods.base_category import BaseCategory
from tests.test_utils import MockedClient, with_mocked_api
from vkbottle import (
API,
AndRule,
BaseStateGroup,
Bot,
GroupEventType,
GroupTypes,
NotRule,
... | bot.router.views["message"] | assert | complex_expr | tests/test_bot.py | test_bot_scopes | 162 | null | |
vkbottle/vkbottle | import pytest
from vkbottle import CodeException, ErrorHandler
@pytest.mark.asyncio
async def test_error_handler():
class Base(Exception):
pass
class Derived(Base):
pass
error_handler = ErrorHandler()
@error_handler.register_error_handler(Base)
async def handler(error: Exception... | 42 | assert | numeric_literal | tests/test_exception_handling.py | test_error_handler | 35 | null | |
vkbottle/vkbottle | from __future__ import annotations
import asyncio
import os
import re
from io import StringIO
from typing import TYPE_CHECKING
import pytest
from vkbottle import API
from vkbottle.bot import Bot, run_multibot
from vkbottle.dispatch import ABCRule, AndRule, NotRule, OrRule
from vkbottle.exception_factory.base_excepti... | "+7 *** *** ** 89" | assert | string_literal | tests/tools/test_tools.py | test_user_auth_with_2fa | 271 | null | |
vkbottle/vkbottle | from typing import Any
import pytest
from tests.test_utils import MockedClient
from vkbottle import API
from vkbottle.tools.mini_types.bot.foreign_message import ForeignMessageMin
def fake_foreign_message(ctx_api: API, **data: Any) -> ForeignMessageMin:
message = {
"peer_id": 1,
"date": 1,
... | 999 | assert | numeric_literal | tests/test_foreign_message.py | test_get_full_message_with_explicit_peer_id | 110 | null | |
vkbottle/vkbottle | from vkbottle.tools import Formatter, bold, italic, underline, url
def test_functional_equivalence():
funcs_1 = bold("Hello") + ", 🌍"
formatter_1 = Formatter("{:bold}, 🌍").format("Hello")
assert funcs_1.as_data() == formatter_1.format_data
funcs_2 = "👋, " + bold("world")
formatter_2 = Formatter... | formatter_4.format_data | assert | complex_expr | tests/tools/test_formatting.py | test_functional_equivalence | 221 | null | |
vkbottle/vkbottle | from __future__ import annotations
import asyncio
import os
import re
from io import StringIO
from typing import TYPE_CHECKING
import pytest
from vkbottle import API
from vkbottle.bot import Bot, run_multibot
from vkbottle.dispatch import ABCRule, AndRule, NotRule, OrRule
from vkbottle.exception_factory.base_excepti... | OrRule(c_rule(None)).__class__ | assert | func_call | tests/tools/test_tools.py | test_utils | 213 | null | |
vkbottle/vkbottle | from __future__ import annotations
import asyncio
import os
import re
from io import StringIO
from typing import TYPE_CHECKING
import pytest
from vkbottle import API
from vkbottle.bot import Bot, run_multibot
from vkbottle.dispatch import ABCRule, AndRule, NotRule, OrRule
from vkbottle.exception_factory.base_excepti... | "task_to_run" | assert | string_literal | tests/tools/test_tools.py | test_utils | 207 | null | |
vkbottle/vkbottle | import json
from typing import Any, Callable
import pytest
import vbml
from vkbottle_types.methods.base_category import BaseCategory
from tests.test_utils import MockedClient, with_mocked_api
from vkbottle import (
API,
AndRule,
BaseStateGroup,
Bot,
GroupEventType,
GroupTypes,
NotRule,
... | True | assert | bool_literal | tests/test_bot.py | test_rules | 272 | null | |
vkbottle/vkbottle | import pickle
from vkbottle.exception_factory import CodeException, VKAPIError
def test_code_exception_getitem_given_single_code_returns_subclass_with_specified_code():
assert issubclass(CodeError[6], CodeError)
assert CodeError[9].code == | 9 | assert | numeric_literal | tests/test_exceptions.py | test_code_exception_getitem_given_single_code_returns_subclass_with_specified_code | 16 | null | |
vkbottle/vkbottle | from vkbottle.tools import Formatter, bold, italic, underline, url
def test_functional_equivalence():
funcs_1 = bold("Hello") + ", 🌍"
formatter_1 = Formatter("{:bold}, 🌍").format("Hello")
assert funcs_1.as_data() == formatter_1.format_data
funcs_2 = "👋, " + bold("world")
formatter_2 = Formatter... | formatter_2.format_data | assert | complex_expr | tests/tools/test_formatting.py | test_functional_equivalence | 213 | null | |
vkbottle/vkbottle | import json
from typing import Any, Callable
import pytest
import vbml
from vkbottle_types.methods.base_category import BaseCategory
from tests.test_utils import MockedClient, with_mocked_api
from vkbottle import (
API,
AndRule,
BaseStateGroup,
Bot,
GroupEventType,
GroupTypes,
NotRule,
... | { "peer_ids": str(message.peer_id), "r": 1, "random_id": 0, } | assert | collection | tests/test_bot.py | message_handler | 138 | null | |
vkbottle/vkbottle | import json
from typing import Any, Callable
import pytest
import vbml
from vkbottle_types.methods.base_category import BaseCategory
from tests.test_utils import MockedClient, with_mocked_api
from vkbottle import (
API,
AndRule,
BaseStateGroup,
Bot,
GroupEventType,
GroupTypes,
NotRule,
... | bot.api | assert | complex_expr | tests/test_bot.py | wall_post_handler | 132 | null | |
vkbottle/vkbottle | from vkbottle.tools import Formatter, bold, italic, underline, url
def test_utf16_formatter():
s1 = Formatter("{:bold}, 🌍").format("Hello")
assert s1.format_data == {
"version": Formatter.VERSION,
"items": [{"type": "bold", "offset": 0, "length": 5}],
}
s2 = Formatter("👋, {:bold}!").... | { "version": Formatter.VERSION, "items": [{"type": "italic", "offset": 40, "length": 5}], } | assert | collection | tests/tools/test_formatting.py | test_utf16_formatter | 129 | null | |
vkbottle/vkbottle | from typing import Any
import pytest
from tests.test_utils import with_mocked_api
from vkbottle import API, ABCRequestRescheduler, APIAuthError, CaptchaError, CtxStorage, VKAPIError
USERS_GET_RESPONSE = (
'{"response":[{"first_name":"Павел","id":1,"last_name":"Дуров",'
'"can_access_closed":true,"is_closed":f... | "Павел" | assert | string_literal | tests/test_api.py | test_api_raw_response | 31 | null | |
vkbottle/vkbottle | import pytest
from vkbottle import CodeException, ErrorHandler
def test_code_error():
class CodeError(CodeException):
pass
try:
raise CodeError[1]
except CodeError[2] as e:
raise AssertionError from e
except CodeError[3, 4] as e:
raise AssertionError from e
except ... | 1 | assert | numeric_literal | tests/test_exception_handling.py | test_code_error | 17 | null | |
vkbottle/vkbottle | from __future__ import annotations
import asyncio
import os
import re
from io import StringIO
from typing import TYPE_CHECKING
import pytest
from vkbottle import API
from vkbottle.bot import Bot, run_multibot
from vkbottle.dispatch import ABCRule, AndRule, NotRule, OrRule
from vkbottle.exception_factory.base_excepti... | rev | assert | variable | tests/tools/test_tools.py | assert_rule | 85 | null | |
vkbottle/vkbottle | from typing import Any
import pytest
from tests.test_utils import with_mocked_api
from vkbottle import API, ABCRequestRescheduler, APIAuthError, CaptchaError, CtxStorage, VKAPIError
USERS_GET_RESPONSE = (
'{"response":[{"first_name":"Павел","id":1,"last_name":"Дуров",'
'"can_access_closed":true,"is_closed":f... | 14 | assert | numeric_literal | tests/test_api.py | test_captcha_error_handling | 66 | null | |
vkbottle/vkbottle | from vkbottle import vkscript
BASIC_CYCLE = "var a=%A%;var some_list=[];while(a<100){API.users.get({user_id:a});a = a + 1;some_list.push(a);};return some_list;"
API_REQUEST = "var group_id=%A%;return API.groups.getById({group_id:group_id});"
def basic_cycle(api, a: int = 10):
some_list = []
while a < 100:
... | BASIC_CYCLE.replace("%A%", "94") | assert | func_call | tests/tools/test_vkscript_converter.py | test_vkscript | 48 | null | |
vkbottle/vkbottle | from __future__ import annotations
import asyncio
import os
import re
from io import StringIO
from typing import TYPE_CHECKING
import pytest
from vkbottle import API
from vkbottle.bot import Bot, run_multibot
from vkbottle.dispatch import ABCRule, AndRule, NotRule, OrRule
from vkbottle.exception_factory.base_excepti... | APIAuthError) | pytest.raises | variable | tests/tools/test_tools.py | test_user_auth_with_2fa | 266 | null | |
vkbottle/vkbottle | from __future__ import annotations
import asyncio
import os
import re
from io import StringIO
from typing import TYPE_CHECKING
import pytest
from vkbottle import API
from vkbottle.bot import Bot, run_multibot
from vkbottle.dispatch import ABCRule, AndRule, NotRule, OrRule
from vkbottle.exception_factory.base_excepti... | "https://m.vk.ru/login?act=authcheck&api_hash=someapihash" | assert | string_literal | tests/tools/test_tools.py | test_user_auth_with_2fa | 272 | null | |
vkbottle/vkbottle | import json
from typing import Any, Callable
import pytest
import vbml
from vkbottle_types.methods.base_category import BaseCategory
from tests.test_utils import MockedClient, with_mocked_api
from vkbottle import (
API,
AndRule,
BaseStateGroup,
Bot,
GroupEventType,
GroupTypes,
NotRule,
... | {} | assert | collection | tests/test_bot.py | test_rules | 278 | null | |
vkbottle/vkbottle | import json
from typing import Any, Callable
import pytest
import vbml
from vkbottle_types.methods.base_category import BaseCategory
from tests.test_utils import MockedClient, with_mocked_api
from vkbottle import (
API,
AndRule,
BaseStateGroup,
Bot,
GroupEventType,
GroupTypes,
NotRule,
... | 1 | assert | numeric_literal | tests/test_bot.py | message_handler | 137 | null | |
vkbottle/vkbottle | from vkbottle.tools import Formatter, bold, italic, underline, url
def test_utf16_formatter():
s1 = Formatter("{:bold}, 🌍").format("Hello")
assert s1.format_data == {
"version": Formatter.VERSION,
"items": [{"type": "bold", "offset": 0, "length": 5}],
}
s2 = Formatter("👋, {:bold}!").... | { "version": Formatter.VERSION, "items": [{"type": "italic", "offset": 7, "length": 10}], } | assert | collection | tests/tools/test_formatting.py | test_utf16_formatter | 135 | null | |
pydantic/pydantic-settings | import pytest
from pydantic import BaseModel, Field, ValidationError
from pytest_mock import MockerFixture
from pydantic_settings import (
AzureKeyVaultSettingsSource,
BaseSettings,
PydanticBaseSettingsSource,
)
from pydantic_settings.sources.providers.azure import import_azure_key_vault
class TestAzureKe... | ValidationError) | pytest.raises | variable | tests/test_source_azure_key_vault.py | test_snake_case_conversion_missing_alias | TestAzureKeyVaultSettingsSource | 313 | null |
pydantic/pydantic-settings | from enum import Enum
from os import sep
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
NestedSecretsSettingsSource,
SecretsSettingsSource,
SettingsConfigDict,
SettingsError,
)
from pydantic_settings.sources.providers.nested_secrets import SECRETS_DIR_MA... | value | assert | variable | tests/test_source_nested_secrets.py | test_multiple_secrets_dirs | 337 | null | |
pydantic/pydantic-settings | from enum import Enum
from os import sep
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
NestedSecretsSettingsSource,
SecretsSettingsSource,
SettingsConfigDict,
SettingsError,
)
from pydantic_settings.sources.providers.nested_secrets import SECRETS_DIR_MA... | { 'app_key': 'secret1', 'db': {'user': 'user', 'passwd': 'secret2'}, } | assert | collection | tests/test_source_nested_secrets.py | test_delimited_name | 92 | null | |
pydantic/pydantic-settings | from enum import Enum
from os import sep
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
NestedSecretsSettingsSource,
SecretsSettingsSource,
SettingsConfigDict,
SettingsError,
)
from pydantic_settings.sources.providers.nested_secrets import SECRETS_DIR_MA... | getattr(evaluated, k) | assert | func_call | tests/test_source_nested_secrets.py | test_env_ignore_empty | 428 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
def test_repr() -> None:
source = YamlConfigSettingsSource(BaseSettings, Path('config.yaml'))
assert... | 'YamlConfigSettingsSource(yaml_file=config.yaml)' | assert | string_literal | tests/test_source_yaml.py | test_repr | 25 | null | |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pytest_mock import MockerFixture
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
PyprojectTomlConfigSettingsSource,
SettingsConfigDict,
)
MODULE = 'pydantic_settings.sources.providers.pypro... | tmp_path / 'pyproject.toml' | assert | complex_expr | tests/test_source_pyproject_toml.py | test___init__ | TestPyprojectTomlConfigSettingsSource | 57 | null |
pydantic/pydantic-settings | import dataclasses
import json
import os
import pathlib
import sys
import uuid
from collections.abc import Callable, Hashable
from datetime import date, datetime, timezone
from enum import IntEnum
from pathlib import Path
from typing import Annotated, Any, Generic, Literal, TypeVar
from unittest import mock
import pyt... | 1 | assert | numeric_literal | tests/test_settings.py | test_generic_dataclass | 607 | null | |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
TomlConfigSettingsSource,
)
@pytest.mark.skipif(sys.version_info <= (3, 11) and tomli is None, reason='tomli/tomllib is not in... | {'toml1': 1, 'toml2': 2} | assert | collection | tests/test_source_toml.py | test_multiple_file_toml | 116 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYAML is not installed')
def test_yaml_config_section_unusual_lite... | 'has consecutive dots' | assert | string_literal | tests/test_source_yaml.py | test_yaml_config_section_unusual_literal_keys | 543 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYAML is not installed')
def test_yaml_config_section_with_literal... | 'prod.example.com' | assert | string_literal | tests/test_source_yaml.py | test_yaml_config_section_with_literal_dots | 436 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYaml is not installed')
def test_yaml_file(tmp_path):
p = tmp... | 'world!' | assert | string_literal | tests/test_source_yaml.py | test_yaml_file | 90 | null | |
pydantic/pydantic-settings | import dataclasses
import json
import os
import pathlib
import sys
import uuid
from collections.abc import Callable, Hashable
from datetime import date, datetime, timezone
from enum import IntEnum
from pathlib import Path
from typing import Annotated, Any, Generic, Literal, TypeVar
from unittest import mock
import pyt... | {} | assert | collection | tests/test_settings.py | test_class_nested_model_default_partial_update | 705 | null | |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pytest_mock import MockerFixture
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
PyprojectTomlConfigSettingsSource,
SettingsConfigDict,
)
MODULE = 'pydantic_settings.sources.providers.pypro... | {'field': None} | assert | collection | tests/test_source_pyproject_toml.py | test_pyproject_toml_no_file_explicit | 284 | null | |
pydantic/pydantic-settings | import pytest
from pydantic import BaseModel, Field, ValidationError
from pytest_mock import MockerFixture
from pydantic_settings import (
AzureKeyVaultSettingsSource,
BaseSettings,
PydanticBaseSettingsSource,
)
from pydantic_settings.sources.providers.azure import import_azure_key_vault
class TestAzureKe... | settings | assert | variable | tests/test_source_azure_key_vault.py | test_do_not_load_disabled_secrets | TestAzureKeyVaultSettingsSource | 105 | null |
pydantic/pydantic-settings | from __future__ import annotations as _annotations
from pathlib import Path
from typing import Literal
from pydantic import AnyHttpUrl, Field
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
def test_merging_preserves_earlier_values(tmp_path: Path, env):
... | 20 | assert | numeric_literal | tests/test_precedence_and_merging.py | test_merging_preserves_earlier_values | 117 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYAML is not installed')
def test_yaml_config_section_nested_path_... | 8000 | assert | numeric_literal | tests/test_source_yaml.py | test_yaml_config_section_nested_path_two_levels | 344 | null | |
pydantic/pydantic-settings | from typing import Annotated
import pytest
from pydantic import Field
from pytest_mock import MockerFixture
from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict
from pydantic_settings.sources import GoogleSecretManagerSettingsSource
from pydantic_settings.sources.providers.gcp im... | 'v1-value' | assert | string_literal | tests/test_source_gcp_secret_manager.py | test_secret_version_annotation | TestGoogleSecretManagerSettingsSource | 472 | null |
pydantic/pydantic-settings | from __future__ import annotations as _annotations
from pathlib import Path
from typing import Literal
from pydantic import AnyHttpUrl, Field
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
def test_precedence_init_over_env(tmp_path: Path, env):
class ... | 'from-init' | assert | string_literal | tests/test_precedence_and_merging.py | test_precedence_init_over_env | 32 | null | |
pydantic/pydantic-settings | from enum import Enum
from os import sep
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
NestedSecretsSettingsSource,
SecretsSettingsSource,
SettingsConfigDict,
SettingsError,
)
from pydantic_settings.sources.providers.nested_secrets import SECRETS_DIR_MA... | expected | assert | variable | tests/test_source_nested_secrets.py | test_multiple_secrets_dirs | 324 | null | |
pydantic/pydantic-settings | from enum import Enum
from os import sep
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
NestedSecretsSettingsSource,
SecretsSettingsSource,
SettingsConfigDict,
SettingsError,
)
from pydantic_settings.sources.providers.nested_secrets import SECRETS_DIR_MA... | evaluated.model_dump() | assert | func_call | tests/test_source_nested_secrets.py | test_env_ignore_empty | 426 | null | |
pydantic/pydantic-settings | from __future__ import annotations as _annotations
from pathlib import Path
from typing import Literal
from pydantic import AnyHttpUrl, Field
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
def test_precedence_secrets_over_defaults(tmp_path: Path):
sec... | 'from-secrets' | assert | string_literal | tests/test_precedence_and_merging.py | test_precedence_secrets_over_defaults | 80 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYaml is not installed')
def test_yaml_file(tmp_path):
p = tmp... | 'Hello' | assert | string_literal | tests/test_source_yaml.py | test_yaml_file | 89 | null | |
pydantic/pydantic-settings | import argparse
import asyncio
import re
import sys
import time
import typing
from enum import IntEnum
from pathlib import Path, PureWindowsPath
from typing import Annotated, Any, Dict, Generic, List, Literal, Tuple, TypeVar, Union # noqa: UP035
import pytest
import typing_extensions
from pydantic import (
AliasC... | ['abc'] | assert | collection | tests/test_source_cli.py | test_cli_app_with_separate_parser | 2,972 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYAML is not installed')
def test_yaml_config_section_unusual_lite... | 'has trailing dot' | assert | string_literal | tests/test_source_yaml.py | test_yaml_config_section_unusual_literal_keys | 524 | null | |
pydantic/pydantic-settings | import argparse
import asyncio
import re
import sys
import time
import typing
from enum import IntEnum
from pathlib import Path, PureWindowsPath
from typing import Annotated, Any, Dict, Generic, List, Literal, Tuple, TypeVar, Union # noqa: UP035
import pytest
import typing_extensions
from pydantic import (
AliasC... | 4 | assert | numeric_literal | tests/test_source_cli.py | test_cli_app_with_separate_parser | 2,970 | null | |
pydantic/pydantic-settings | import importlib.resources
import json
import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
JsonConfigSettingsSource,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
def test_json_file(tmp_path):
p = tmp_path / '.env'
... | 'Hello' | assert | string_literal | tests/test_source_json.py | test_json_file | 61 | null | |
pydantic/pydantic-settings | from typing import Annotated
import pytest
from pydantic import Field
from pytest_mock import MockerFixture
from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict
from pydantic_settings.sources import GoogleSecretManagerSettingsSource
from pydantic_settings.sources.providers.gcp im... | 'test-project' | assert | string_literal | tests/test_source_gcp_secret_manager.py | test_secret_manager_mapping_init | TestGoogleSecretManagerSettingsSource | 120 | null |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYAML is not installed')
def test_yaml_config_section_nested_path(... | 'secret123' | assert | string_literal | tests/test_source_yaml.py | test_yaml_config_section_nested_path | 310 | null | |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pytest_mock import MockerFixture
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
PyprojectTomlConfigSettingsSource,
SettingsConfigDict,
)
MODULE = 'pydantic_settings.sources.providers.pypro... | 'world!' | assert | string_literal | tests/test_source_pyproject_toml.py | test_pyproject_toml_file | 132 | null | |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
TomlConfigSettingsSource,
)
@pytest.mark.skipif(sys.version_info <= (3, 11) and tomli is None, reason='tomli/tomllib is not in... | {'hello': 'world', 'nested': {'foo': 3, 'bar': 2 if deep_merge else 0}} | assert | collection | tests/test_source_toml.py | test_multiple_file_toml_merge | 160 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYAML is not installed')
def test_yaml_config_section_complex_unus... | 'regular value' | assert | string_literal | tests/test_source_yaml.py | test_yaml_config_section_complex_unusual_keys | 579 | null | |
pydantic/pydantic-settings | import dataclasses
import json
import os
import pathlib
import sys
import uuid
from collections.abc import Callable, Hashable
from datetime import date, datetime, timezone
from enum import IntEnum
from pathlib import Path
from typing import Annotated, Any, Generic, Literal, TypeVar
from unittest import mock
import pyt... | '2' | assert | string_literal | tests/test_settings.py | test_env_file_export_validation_alias | 1,367 | null | |
pydantic/pydantic-settings | from typing import Annotated
import pytest
from pydantic import Field
from pytest_mock import MockerFixture
from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict
from pydantic_settings.sources import GoogleSecretManagerSettingsSource
from pydantic_settings.sources.providers.gcp im... | credentials | assert | variable | tests/test_source_gcp_secret_manager.py | test_settings_source_init | TestGoogleSecretManagerSettingsSource | 157 | null |
pydantic/pydantic-settings | import dataclasses
import json
import os
import pathlib
import sys
import uuid
from collections.abc import Callable, Hashable
from datetime import date, datetime, timezone
from enum import IntEnum
from pathlib import Path
from typing import Annotated, Any, Generic, Literal, TypeVar
from unittest import mock
import pyt... | 5 | assert | numeric_literal | tests/test_settings.py | test_warns_if_config_keys_are_set_but_source_is_missing | 3,367 | null | |
pydantic/pydantic-settings | import dataclasses
import json
import os
import pathlib
import sys
import uuid
from collections.abc import Callable, Hashable
from datetime import date, datetime, timezone
from enum import IntEnum
from pathlib import Path
from typing import Annotated, Any, Generic, Literal, TypeVar
from unittest import mock
import pyt... | 2 | assert | numeric_literal | tests/test_settings.py | test_secrets_missing_location_multiple_all | 1,877 | null | |
pydantic/pydantic-settings | import json
import os
import pytest
from pydantic import BaseModel, Field
from pydantic_settings import (
AWSSecretsManagerSettingsSource,
BaseSettings,
PydanticBaseSettingsSource,
)
from pydantic_settings.sources.providers.aws import import_aws_secrets_manager
MODULE = 'pydantic_settings.sources'
clas... | 'test-user' | assert | string_literal | tests/test_source_aws_secrets_manager.py | test___call__ | TestAWSSecretsManagerSettingsSource | 88 | null |
pydantic/pydantic-settings | from __future__ import annotations as _annotations
from pathlib import Path
from typing import Literal
from pydantic import AnyHttpUrl, Field
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
def test_init_kwargs_override_env_with_alias_and_extra_forbid(env)... | 'hosted' | assert | string_literal | tests/test_precedence_and_merging.py | test_init_kwargs_override_env_with_alias_and_extra_forbid | 136 | null | |
pydantic/pydantic-settings | import importlib.resources
import json
import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
JsonConfigSettingsSource,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
class TestTraversableSupport:
FILENAME = 'example_test... | 'test' | assert | string_literal | tests/test_source_json.py | test_traversable_support | TestTraversableSupport | 222 | null |
pydantic/pydantic-settings | import importlib.resources
import json
import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
JsonConfigSettingsSource,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
def test_json_no_file():
class Settings(BaseSettings):... | {} | assert | collection | tests/test_source_json.py | test_json_no_file | 81 | null | |
pydantic/pydantic-settings | from pydantic_settings.utils import path_type_label
def test_path_type_label(tmp_path):
result = path_type_label(tmp_path)
assert result == | 'directory' | assert | string_literal | tests/test_utils.py | test_path_type_label | 6 | null | |
pydantic/pydantic-settings | import argparse
import asyncio
import re
import sys
import time
import typing
from enum import IntEnum
from pathlib import Path, PureWindowsPath
from typing import Annotated, Any, Dict, Generic, List, Literal, Tuple, TypeVar, Union # noqa: UP035
import pytest
import typing_extensions
from pydantic import (
AliasC... | 123 | assert | numeric_literal | tests/test_source_cli.py | test_cli_nested_dataclass_arg | 694 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYAML is not installed')
def test_yaml_config_section_unusual_lite... | 'has leading dot' | assert | string_literal | tests/test_source_yaml.py | test_yaml_config_section_unusual_literal_keys | 505 | null | |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pytest_mock import MockerFixture
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
PyprojectTomlConfigSettingsSource,
SettingsConfigDict,
)
MODULE = 'pydantic_settings.sources.providers.pypro... | 'success' | assert | string_literal | tests/test_source_pyproject_toml.py | test_pyproject_toml_file_header | 248 | null | |
pydantic/pydantic-settings | import json
import os
import pytest
from pydantic import BaseModel, Field
from pydantic_settings import (
AWSSecretsManagerSettingsSource,
BaseSettings,
PydanticBaseSettingsSource,
)
from pydantic_settings.sources.providers.aws import import_aws_secrets_manager
MODULE = 'pydantic_settings.sources'
clas... | "AWSSecretsManagerSettingsSource(secret_id='test-secret', env_nested_delimiter='--')" | assert | string_literal | tests/test_source_aws_secrets_manager.py | test_repr | TestAWSSecretsManagerSettingsSource | 52 | null |
pydantic/pydantic-settings | from typing import Annotated
import pytest
from pydantic import Field
from pytest_mock import MockerFixture
from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict
from pydantic_settings.sources import GoogleSecretManagerSettingsSource
from pydantic_settings.sources.providers.gcp im... | 'v2-val' | assert | string_literal | tests/test_source_gcp_secret_manager.py | test_secret_version_annotation_case_insensitive_multiple_versions | TestGoogleSecretManagerSettingsSource | 558 | null |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYAML is not installed')
def test_yaml_config_section_nested_path(... | 'postgresql://localhost/db' | assert | string_literal | tests/test_source_yaml.py | test_yaml_config_section_nested_path | 309 | null | |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pytest_mock import MockerFixture
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
PyprojectTomlConfigSettingsSource,
SettingsConfigDict,
)
MODULE = 'pydantic_settings.sources.providers.pypro... | {} | assert | collection | tests/test_source_pyproject_toml.py | test_pyproject_toml_no_file | 264 | null | |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
TomlConfigSettingsSource,
)
def test_repr() -> None:
source = TomlConfigSettingsSource(BaseSettings, Path('config.toml'))
... | 'TomlConfigSettingsSource(toml_file=config.toml)' | assert | string_literal | tests/test_source_toml.py | test_repr | 26 | null | |
pydantic/pydantic-settings | from __future__ import annotations as _annotations
from pathlib import Path
from typing import Literal
from pydantic import AnyHttpUrl, Field
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
def test_merging_preserves_earlier_values(tmp_path: Path, env):
... | 10 | assert | numeric_literal | tests/test_precedence_and_merging.py | test_merging_preserves_earlier_values | 116 | null | |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pytest_mock import MockerFixture
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
PyprojectTomlConfigSettingsSource,
SettingsConfigDict,
)
MODULE = 'pydantic_settings.sources.providers.pypro... | {'field': 'some'} | assert | collection | tests/test_source_pyproject_toml.py | test___init__ | TestPyprojectTomlConfigSettingsSource | 56 | null |
pydantic/pydantic-settings | import argparse
import asyncio
import re
import sys
import time
import typing
from enum import IntEnum
from pathlib import Path, PureWindowsPath
from typing import Annotated, Any, Dict, Generic, List, Literal, Tuple, TypeVar, Union # noqa: UP035
import pytest
import typing_extensions
from pydantic import (
AliasC... | None | assert | none_literal | tests/test_source_cli.py | test_cli_subcommand_with_positionals | 1,318 | null | |
pydantic/pydantic-settings | from typing import Annotated
import pytest
from pydantic import Field
from pytest_mock import MockerFixture
from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict
from pydantic_settings.sources import GoogleSecretManagerSettingsSource
from pydantic_settings.sources.providers.gcp im... | 1 | assert | numeric_literal | tests/test_source_gcp_secret_manager.py | test_secret_manager_cache_behavior | TestGoogleSecretManagerSettingsSource | 607 | null |
pydantic/pydantic-settings | from enum import Enum
from os import sep
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
NestedSecretsSettingsSource,
SecretsSettingsSource,
SettingsConfigDict,
SettingsError,
)
from pydantic_settings.sources.providers.nested_secrets import SECRETS_DIR_MA... | SettingsError, match='mutually exclusive') | pytest.raises | complex_expr | tests/test_source_nested_secrets.py | test_invalid_options | 374 | null | |
pydantic/pydantic-settings | from typing import Annotated
import pytest
from pydantic import Field
from pytest_mock import MockerFixture
from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict
from pydantic_settings.sources import GoogleSecretManagerSettingsSource
from pydantic_settings.sources.providers.gcp im... | repr(source) | assert | func_call | tests/test_source_gcp_secret_manager.py | test_settings_source_repr | TestGoogleSecretManagerSettingsSource | 178 | null |
pydantic/pydantic-settings | from typing import Annotated
import pytest
from pydantic import Field
from pytest_mock import MockerFixture
from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict
from pydantic_settings.sources import GoogleSecretManagerSettingsSource
from pydantic_settings.sources.providers.gcp im... | None | assert | none_literal | tests/test_source_gcp_secret_manager.py | test_secret_manager_mapping_getitem_access_error | TestGoogleSecretManagerSettingsSource | 136 | null |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYAML is not installed')
def test_yaml_config_section_nested_path_... | 'localhost' | assert | string_literal | tests/test_source_yaml.py | test_yaml_config_section_nested_path_two_levels | 343 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYaml is not installed')
def test_yaml_no_file():
class Settin... | {} | assert | collection | tests/test_source_yaml.py | test_yaml_no_file | 110 | null | |
pydantic/pydantic-settings | from __future__ import annotations as _annotations
from pathlib import Path
from typing import Literal
from pydantic import AnyHttpUrl, Field
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
def test_init_kwargs_override_env_for_alias_with_populate_by_name(... | 'http://prod.localhost.com/' | assert | string_literal | tests/test_precedence_and_merging.py | test_init_kwargs_override_env_for_alias_with_populate_by_name | 23 | null | |
pydantic/pydantic-settings | from enum import Enum
from os import sep
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
NestedSecretsSettingsSource,
SecretsSettingsSource,
SettingsConfigDict,
SettingsError,
)
from pydantic_settings.sources.providers.nested_secrets import SECRETS_DIR_MA... | warning_count | assert | variable | tests/test_source_nested_secrets.py | test_multiple_secrets_dirs | 335 | null | |
pydantic/pydantic-settings | from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
YamlConfigSettingsSource,
)
@pytest.mark.skipif(yaml is None, reason='pyYAML is not installed')
def test_yaml_config_section_with_literal... | 443 | assert | numeric_literal | tests/test_source_yaml.py | test_yaml_config_section_with_literal_dots | 437 | null | |
pydantic/pydantic-settings | import dataclasses
import json
import os
import pathlib
import sys
import uuid
from collections.abc import Callable, Hashable
from datetime import date, datetime, timezone
from enum import IntEnum
from pathlib import Path
from typing import Annotated, Any, Generic, Literal, TypeVar
from unittest import mock
import pyt... | 'y' | assert | string_literal | tests/test_settings.py | test_dotenv_extra_allow | 2,374 | null | |
pydantic/pydantic-settings | import importlib.resources
import json
import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
JsonConfigSettingsSource,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
@pytest.mark.parametrize('deep_merge', [False, True])
def ... | {'hello': 'world', 'nested': {'foo': 3, 'bar': 2 if deep_merge else 0}} | assert | collection | tests/test_source_json.py | test_multiple_file_json_merge | 142 | null | |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pytest_mock import MockerFixture
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
PyprojectTomlConfigSettingsSource,
SettingsConfigDict,
)
MODULE = 'pydantic_settings.sources.providers.pypro... | pyproject | assert | variable | tests/test_source_pyproject_toml.py | test___init___explicit | TestPyprojectTomlConfigSettingsSource | 68 | null |
pydantic/pydantic-settings | from enum import Enum
from os import sep
import pytest
from pydantic import BaseModel
from pydantic_settings import (
BaseSettings,
NestedSecretsSettingsSource,
SecretsSettingsSource,
SettingsConfigDict,
SettingsError,
)
from pydantic_settings.sources.providers.nested_secrets import SECRETS_DIR_MA... | { 'app_key': None, 'db': {'user': 'user', 'passwd': None}, } | assert | collection | tests/test_source_nested_secrets.py | test_source_off | 70 | null | |
pydantic/pydantic-settings | import argparse
import asyncio
import re
import sys
import time
import typing
from enum import IntEnum
from pathlib import Path, PureWindowsPath
from typing import Annotated, Any, Dict, Generic, List, Literal, Tuple, TypeVar, Union # noqa: UP035
import pytest
import typing_extensions
from pydantic import (
AliasC... | True | assert | bool_literal | tests/test_source_cli.py | test_cli_bool_with_non_type_metadata | 2,557 | null | |
pydantic/pydantic-settings | import json
import os
import pytest
from pydantic import BaseModel, Field
from pydantic_settings import (
AWSSecretsManagerSettingsSource,
BaseSettings,
PydanticBaseSettingsSource,
)
from pydantic_settings.sources.providers.aws import import_aws_secrets_manager
MODULE = 'pydantic_settings.sources'
clas... | 'test-password' | assert | string_literal | tests/test_source_aws_secrets_manager.py | test___call__ | TestAWSSecretsManagerSettingsSource | 89 | null |
pydantic/pydantic-settings | import sys
from pathlib import Path
import pytest
from pydantic import BaseModel
from pytest_mock import MockerFixture
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
PyprojectTomlConfigSettingsSource,
SettingsConfigDict,
)
MODULE = 'pydantic_settings.sources.providers.pypro... | ('some', 'table') | assert | collection | tests/test_source_pyproject_toml.py | test___init__ | TestPyprojectTomlConfigSettingsSource | 55 | null |
pydantic/pydantic-settings | from __future__ import annotations as _annotations
from pathlib import Path
from typing import Literal
from pydantic import AnyHttpUrl, Field
from pydantic_settings import (
BaseSettings,
PydanticBaseSettingsSource,
SettingsConfigDict,
)
def test_precedence_dotenv_over_secrets(tmp_path: Path):
# cre... | 'from-dotenv' | assert | string_literal | tests/test_precedence_and_merging.py | test_precedence_dotenv_over_secrets | 66 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.