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 |
|---|---|---|---|---|---|---|---|---|---|
DisnakeDev/disnake | import io
from datetime import datetime, timedelta
import pytest
from disnake import Color, Embed, File, embeds
from disnake.utils import MISSING, utcnow
_BASE = {"type": "rich"}
def embed() -> Embed:
time = utcnow() + timedelta(days=42)
return Embed(
type="link",
title="wow",
descri... | 30 | assert | numeric_literal | tests/test_embeds.py | test_len | 78 | null | |
DisnakeDev/disnake | import io
from datetime import datetime, timedelta
import pytest
from disnake import Color, Embed, File, embeds
from disnake.utils import MISSING, utcnow
_BASE = {"type": "rich"}
def embed() -> Embed:
time = utcnow() + timedelta(days=42)
return Embed(
type="link",
title="wow",
descri... | 2 | assert | numeric_literal | tests/test_embeds.py | test_attr_proxy | 202 | null | |
DisnakeDev/disnake | import warnings
import pytest
import disnake
from disnake import Permissions
from disnake.ext import commands
def meta(request) -> DecoratorMeta:
return DecoratorMeta(request.param)
def test_contexts_guildcommandinteraction(meta: DecoratorMeta) -> None:
class Cog(commands.Cog):
# this shouldn't rais... | disnake.ApplicationInstallTypes(guild=True) | assert | func_call | tests/ext/commands/test_base_core.py | test_contexts_guildcommandinteraction | 110 | null | |
DisnakeDev/disnake | from typing import TYPE_CHECKING
import pytest
from disnake import activity as _activity
def activity() -> _activity.Activity:
return _activity.Activity()
def game() -> _activity.Game:
return _activity.Game(name="Celeste")
def custom_activity() -> _activity.CustomActivity:
return _activity.CustomActivi... | "https://media.discordapp.net/external/stuff/large" | assert | string_literal | tests/test_activity.py | test_mp | TestAssets | 66 | null |
DisnakeDev/disnake | from typing import TYPE_CHECKING
from unittest import mock
import pytest
from typing_extensions import assert_type
import disnake
from disnake.ui import (
ActionRow,
Button,
Label,
Separator,
StringSelect,
TextInput,
WrappedComponent,
)
from disnake.ui._types import ActionRowMessageCompone... | [button1, button2] | assert | collection | tests/ui/test_action_row.py | test_append_item | TestActionRow | 53 | null |
DisnakeDev/disnake | import warnings
import pytest
import disnake
from disnake import Permissions
from disnake.ext import commands
def meta(request) -> DecoratorMeta:
return DecoratorMeta(request.param)
class TestDefaultContexts:
def bot(self) -> commands.InteractionBot:
return commands.InteractionBot(
defa... | [2] | assert | collection | tests/ext/commands/test_base_core.py | test_decorator_override | TestDefaultContexts | 132 | null |
DisnakeDev/disnake | from typing import TYPE_CHECKING
import pytest
from disnake import activity as _activity
def activity() -> _activity.Activity:
return _activity.Activity()
def game() -> _activity.Game:
return _activity.Game(name="Celeste")
def custom_activity() -> _activity.CustomActivity:
return _activity.CustomActivi... | "https://cdn.discordapp.com/app-assets/1010/5678.png" | assert | string_literal | tests/test_activity.py | test_asset_id_activity | TestAssets | 91 | null |
DisnakeDev/disnake | import datetime
from typing import Any
import pytest
from disnake.ext import commands
from disnake.ext.tasks import LF, Loop, loop
class TestLoops:
def test_decorator(self) -> None:
class Cog(commands.Cog):
@loop(seconds=30, minutes=0, hours=0)
async def task(self) -> None: ...
... | 30 | assert | numeric_literal | tests/ext/tasks/test_loops.py | test_decorator | TestLoops | 19 | null |
DisnakeDev/disnake | from typing import Literal
import pytest
from disnake.permissions import PermissionOverwrite, Permissions
class TestPermissions:
def test_init_permissions_keyword_arguments(self) -> None:
perms = Permissions(manage_messages=True)
assert perms.manage_messages is | True | assert | bool_literal | tests/test_permissions.py | test_init_permissions_keyword_arguments | TestPermissions | 14 | null |
DisnakeDev/disnake | from __future__ import annotations
import re
import pytest
from disnake import flags
class TestFlagValue:
def test_flag_value_or(self) -> None:
ins = TestFlags.four | TestFlags.one
assert isinstance(ins, TestFlags)
assert ins.value == 5
assert (TestFlags.two | ins).value == | 7 | assert | numeric_literal | tests/test_flags.py | test_flag_value_or | TestFlagValue | 112 | null |
DisnakeDev/disnake | import inspect
import pytest
from disnake import ui
all_ui_component_types: list[type[ui.UIComponent]] = [
c
for c in ui.__dict__.values()
if isinstance(c, type) and issubclass(c, ui.UIComponent) and not inspect.isabstract(c)
]
all_ui_component_objects: list[ui.UIComponent] = [
ui.ActionRow(),
u... | 1234 | assert | numeric_literal | tests/ui/test_components.py | test_id_property | 50 | null | |
DisnakeDev/disnake | import io
from datetime import datetime, timedelta
import pytest
from disnake import Color, Embed, File, embeds
from disnake.utils import MISSING, utcnow
_BASE = {"type": "rich"}
def embed() -> Embed:
time = utcnow() + timedelta(days=42)
return Embed(
type="link",
title="wow",
descri... | [] | assert | collection | tests/test_embeds.py | test_init_empty | 42 | null | |
DisnakeDev/disnake | from unittest import mock
import pytest
import disnake
from disnake import ui
class TestDefaultValues:
@pytest.mark.parametrize(
"value",
[
disnake.Object(123),
disnake.SelectDefaultValue(123, disnake.SelectDefaultValueType.channel),
mock.Mock(disnake.TextChann... | disnake.SelectDefaultValueType.channel | assert | complex_expr | tests/ui/test_select.py | test_valid | TestDefaultValues | 23 | null |
DisnakeDev/disnake | from __future__ import annotations
import re
import pytest
from disnake import flags
class TestBaseFlags:
def test_iter(self) -> None:
ins = TestFlags(one=True, two=False)
assert len(list(iter(ins))) == | 4 | assert | numeric_literal | tests/test_flags.py | test_iter | TestBaseFlags | 408 | null |
DisnakeDev/disnake | from typing import cast
from unittest import mock
import pytest
import disnake
from disnake.abc import GuildChannel
from disnake.utils import MISSING
class TestGuildChannelEdit:
def channel(self) -> mock.Mock:
ch = mock.Mock(GuildChannel, id=123, category_id=456)
ch._state = mock.Mock(http=mock.... | channel.category_id) | assert_* | complex_expr | tests/test_abc.py | test_sync_permissions | TestGuildChannelEdit | 113 | null |
DisnakeDev/disnake | from unittest import mock
import pytest
import disnake
from disnake import ui
class TestDefaultValues:
@pytest.mark.parametrize(
"value",
[
disnake.Object(123),
disnake.SelectDefaultValue(123, disnake.SelectDefaultValueType.channel),
mock.Mock(disnake.TextChann... | 123 | assert | numeric_literal | tests/ui/test_select.py | test_valid | TestDefaultValues | 22 | null |
DisnakeDev/disnake | from typing import cast
from unittest import mock
import pytest
import disnake
from disnake.abc import GuildChannel
from disnake.utils import MISSING
class TestGuildChannelEdit:
def channel(self) -> mock.Mock:
ch = mock.Mock(GuildChannel, id=123, category_id=456)
ch._state = mock.Mock(http=mock.... | 10) | assert_* | numeric_literal | tests/test_abc.py | test_all | TestGuildChannelEdit | 68 | null |
DisnakeDev/disnake | from typing import TYPE_CHECKING
from unittest import mock
import pytest
from typing_extensions import assert_type
import disnake
from disnake.ui import (
ActionRow,
Button,
Label,
Separator,
StringSelect,
TextInput,
WrappedComponent,
)
from disnake.ui._types import ActionRowMessageCompone... | 0 | assert | numeric_literal | tests/ui/test_action_row.py | test_rows_from_message__invalid | TestActionRow | 175 | null |
DisnakeDev/disnake | from datetime import datetime, timezone
import pytest
from disnake import Object
snowflake = 881536165478499999 # date/time of first commit
def test_compare() -> None:
assert Object(42) == | Object(42) | assert | func_call | tests/test_object.py | test_compare | 20 | null | |
DisnakeDev/disnake | from typing import Any
import pytest
import disnake
from disnake import Event
from disnake.ext import commands
def client() -> disnake.Client:
return disnake.Client()
def bot() -> commands.Bot:
return commands.Bot(
command_prefix=commands.when_mentioned,
command_sync_flags=commands.CommandSy... | on_message_edit | assert | variable | tests/test_events.py | test_event | 39 | null | |
DisnakeDev/disnake | from typing import TYPE_CHECKING
import pytest
from disnake import activity as _activity
def activity() -> _activity.Activity:
return _activity.Activity()
def game() -> _activity.Game:
return _activity.Game(name="Celeste")
def custom_activity() -> _activity.CustomActivity:
return _activity.CustomActivi... | "https://media.discordapp.net/external/stuff/small" | assert | string_literal | tests/test_activity.py | test_mp | TestAssets | 67 | null |
DisnakeDev/disnake | from unittest import mock
import pytest
from disnake import AllowedMentions, Message, MessageType, Object
def test_classmethod_none() -> None:
none = AllowedMentions.none()
assert none.everyone is | False | assert | bool_literal | tests/test_mentions.py | test_classmethod_none | 12 | null | |
DisnakeDev/disnake | import warnings
import pytest
import disnake
from disnake import Permissions
from disnake.ext import commands
def meta(request) -> DecoratorMeta:
return DecoratorMeta(request.param)
class TestDefaultContexts:
def bot(self) -> commands.InteractionBot:
return commands.InteractionBot(
defa... | False | assert | bool_literal | tests/ext/commands/test_base_core.py | test_dm_permission | TestDefaultContexts | 148 | null |
DisnakeDev/disnake | from __future__ import annotations
import re
import pytest
from disnake import flags
def test_flag_creation() -> None:
assert TestFlags.VALID_FLAGS == {
"one": 1,
"two": 2,
"three": 3,
"four": 4,
"sixteen": 16,
}
assert TestFlags.DEFAULT_VALUE == | 0 | assert | numeric_literal | tests/test_flags.py | test_flag_creation | 59 | null | |
DisnakeDev/disnake | from unittest import mock
import pytest
from disnake import (
Guild,
Onboarding,
OnboardingPrompt,
OnboardingPromptOption,
OnboardingPromptType,
)
from disnake.types import onboarding as onboarding_types
onboarding_prompt_option_payload: onboarding_types.OnboardingPromptOption = {
"id": "0",
... | True | assert | bool_literal | tests/test_onboarding.py | test_onboarding | TestOnboarding | 76 | null |
DisnakeDev/disnake | from unittest import mock
import pytest
from disnake import AllowedMentions, Message, MessageType, Object
@pytest.mark.parametrize(
("og", "to_merge", "expected"),
[
(AllowedMentions.none(), AllowedMentions.none(), AllowedMentions.none()),
(AllowedMentions.none(), AllowedMentions(), AllowedMe... | merged.everyone | assert | complex_expr | tests/test_mentions.py | test_merge | 78 | null | |
DisnakeDev/disnake | from typing import cast
from unittest import mock
import pytest
import disnake
from disnake.abc import GuildChannel
from disnake.utils import MISSING
class TestGuildChannelEdit:
def channel(self) -> mock.Mock:
ch = mock.Mock(GuildChannel, id=123, category_id=456)
ch._state = mock.Mock(http=mock.... | 42) | assert_* | numeric_literal | tests/test_abc.py | test_move_only | TestGuildChannelEdit | 105 | null |
DisnakeDev/disnake | import warnings
import pytest
import disnake
from disnake import Permissions
from disnake.ext import commands
def meta(request) -> DecoratorMeta:
return DecoratorMeta(request.param)
class TestDefaultPermissions:
def test_attrs(self, meta: DecoratorMeta) -> None:
kwargs = {meta.attr_key: {"default_m... | Permissions(64) | assert | func_call | tests/ext/commands/test_base_core.py | test_attrs | TestDefaultPermissions | 89 | null |
DisnakeDev/disnake | from unittest import mock
import pytest
from disnake import (
Guild,
Onboarding,
OnboardingPrompt,
OnboardingPromptOption,
OnboardingPromptType,
)
from disnake.types import onboarding as onboarding_types
onboarding_prompt_option_payload: onboarding_types.OnboardingPromptOption = {
"id": "0",
... | 123 | assert | numeric_literal | tests/test_onboarding.py | test_onboarding | TestOnboarding | 73 | null |
DisnakeDev/disnake | from disnake.ext import commands
class TestParents:
def _create_cog(self):
class Cog(commands.Cog):
@commands.slash_command()
async def a(self, _) -> None: ...
@a.sub_command()
async def sub(self, _) -> None: ...
@a.sub_command_group()
... | "a group subsub" | assert | string_literal | tests/ext/commands/test_slash_core.py | test_qualified_name | TestParents | 36 | null |
DisnakeDev/disnake | import asyncio
import datetime
import functools
import inspect
import os
import sys
import warnings
from collections.abc import Callable
from dataclasses import dataclass
from datetime import timedelta, timezone
from typing import (
TYPE_CHECKING,
Annotated,
Any,
Literal,
Optional,
TypeVar,
... | 90 | assert | numeric_literal | tests/test_utils.py | test_sane_wait_for | 397 | null | |
DisnakeDev/disnake | import math
from typing import Any, Optional, Union
from unittest import mock
import pytest
import disnake
from disnake import Member, Role, User
from disnake.ext import commands
OptionType = disnake.OptionType
class TestRangeStringParam:
@pytest.mark.parametrize(
"annotation_str",
[
... | 2 | assert | numeric_literal | tests/ext/commands/test_params.py | test_optional | TestRangeStringParam | 215 | null |
DisnakeDev/disnake | from typing import TYPE_CHECKING
from unittest import mock
import pytest
from typing_extensions import assert_type
import disnake
from disnake.ui import (
ActionRow,
Button,
Label,
Separator,
StringSelect,
TextInput,
WrappedComponent,
)
from disnake.ui._types import ActionRowMessageCompone... | 1 | assert | numeric_literal | tests/ui/test_action_row.py | test_rows_from_message__invalid | TestActionRow | 174 | null |
DisnakeDev/disnake | from typing import Literal
import pytest
from disnake.permissions import PermissionOverwrite, Permissions
class TestPermissions:
def test_init_permissions_keyword_arguments_with_aliases(self) -> None:
assert Permissions(read_messages=True, view_channel=False).value == | 0 | assert | numeric_literal | tests/test_permissions.py | test_init_permissions_keyword_arguments_with_aliases | TestPermissions | 20 | null |
DisnakeDev/disnake | from typing import TYPE_CHECKING
from unittest import mock
import pytest
from typing_extensions import assert_type
import disnake
from disnake.ui import (
ActionRow,
Button,
Label,
Separator,
StringSelect,
TextInput,
WrappedComponent,
)
from disnake.ui._types import ActionRowMessageCompone... | [button2] | assert | collection | tests/ui/test_action_row.py | test_remove_item | TestActionRow | 125 | null |
DisnakeDev/disnake | import math
import pytest
from disnake import Color, Colour
def test_compare() -> None:
assert Colour(123) == | Colour(123) | assert | func_call | tests/test_colour.py | test_compare | 23 | null | |
DisnakeDev/disnake | from typing import Literal
import pytest
from disnake.permissions import PermissionOverwrite, Permissions
class TestPermissionOverwrite:
def test_set(self) -> None:
po = PermissionOverwrite()
po.attach_files = False
assert po.attach_files is | False | assert | bool_literal | tests/test_permissions.py | test_set | TestPermissionOverwrite | 227 | null |
DisnakeDev/disnake | from __future__ import annotations
import re
import pytest
from disnake import flags
class TestFlagValue:
def test_flag_value_xor(self) -> None:
ins = TestFlags(one=True, two=True)
ins ^= TestFlags.two
assert ins.value == 1
ins ^= TestFlags.three
assert ins.value == 2
... | 6 | assert | numeric_literal | tests/test_flags.py | test_flag_value_xor | TestFlagValue | 149 | null |
DisnakeDev/disnake | import asyncio
import datetime
import functools
import inspect
import os
import sys
import warnings
from collections.abc import Callable
from dataclasses import dataclass
from datetime import timedelta, timezone
from typing import (
TYPE_CHECKING,
Annotated,
Any,
Literal,
Optional,
TypeVar,
... | o | assert | variable | tests/test_utils.py | test_sleep_until | 448 | null | |
DisnakeDev/disnake | from __future__ import annotations
import contextlib
from collections.abc import Iterator
from typing import Any, TypeVar
import pytest
from typing_extensions import assert_type
from disnake import ui
from disnake.ui.button import V_co
V = TypeVar("V", bound=ui.View)
I = TypeVar("I", bound=ui.Item)
def create_call... | {"param": 1337} | assert | collection | tests/ui/test_decorators.py | test_cls | TestDecorator | 65 | null |
DisnakeDev/disnake | from typing import Any
import pytest
import disnake
from disnake import Event
from disnake.ext import commands
def client() -> disnake.Client:
return disnake.Client()
def bot() -> commands.Bot:
return commands.Bot(
command_prefix=commands.when_mentioned,
command_sync_flags=commands.CommandSy... | 0 | assert | numeric_literal | tests/test_events.py | test_addremove_listener | 62 | null | |
DisnakeDev/disnake | import asyncio
import datetime
import functools
import inspect
import os
import sys
import warnings
from collections.abc import Callable
from dataclasses import dataclass
from datetime import timedelta, timezone
from typing import (
TYPE_CHECKING,
Annotated,
Any,
Literal,
Optional,
TypeVar,
... | 43 | assert | numeric_literal | tests/test_utils.py | test_maybe_cast | 265 | null | |
DisnakeDev/disnake | from disnake.ext import commands
class TestParents:
def _create_cog(self):
class Cog(commands.Cog):
@commands.slash_command()
async def a(self, _) -> None: ...
@a.sub_command()
async def sub(self, _) -> None: ...
@a.sub_command_group()
... | (cog.a,) | assert | collection | tests/ext/commands/test_slash_core.py | test_parents | TestParents | 48 | null |
DisnakeDev/disnake | import io
from datetime import datetime, timedelta
import pytest
from disnake import Color, Embed, File, embeds
from disnake.utils import MISSING, utcnow
_BASE = {"type": "rich"}
def embed() -> Embed:
time = utcnow() + timedelta(days=42)
return Embed(
type="link",
title="wow",
descri... | 1 | assert | numeric_literal | tests/test_embeds.py | test_attr_proxy | 196 | null | |
DisnakeDev/disnake | import math
from typing import Any, Optional, Union
from unittest import mock
import pytest
import disnake
from disnake import Member, Role, User
from disnake.ext import commands
OptionType = disnake.OptionType
class TestBaseRange:
@pytest.mark.parametrize("empty", [None, ...])
def test_ellipsis(self, empt... | -10 | assert | numeric_literal | tests/ext/commands/test_params.py | test_ellipsis | TestBaseRange | 113 | null |
DisnakeDev/disnake | from __future__ import annotations
from typing import TYPE_CHECKING
from unittest import mock
import pytest
import disnake
from disnake import Interaction, InteractionResponseType as ResponseType # shortcut
from disnake.state import ConnectionState
from disnake.utils import MISSING
class TestInteractionDataResolve... | 1 | assert | numeric_literal | tests/interactions/test_base.py | test_init_member | TestInteractionDataResolved | 170 | null |
DisnakeDev/disnake | from typing import cast
from unittest import mock
import pytest
import disnake
from disnake.abc import GuildChannel
from disnake.utils import MISSING
class TestGuildChannelEdit:
def channel(self) -> mock.Mock:
ch = mock.Mock(GuildChannel, id=123, category_id=456)
ch._state = mock.Mock(http=mock.... | channel._state.http.edit_channel.return_value | assert | complex_expr | tests/test_abc.py | test_all | TestGuildChannelEdit | 66 | null |
DisnakeDev/disnake | import asyncio
import datetime
import functools
import inspect
import os
import sys
import warnings
from collections.abc import Callable
from dataclasses import dataclass
from datetime import timedelta, timezone
from typing import (
TYPE_CHECKING,
Annotated,
Any,
Literal,
Optional,
TypeVar,
... | 42 | assert | numeric_literal | tests/test_utils.py | test_deprecated | 103 | null | |
DisnakeDev/disnake | from disnake.ext import commands
class TestParents:
def _create_cog(self):
class Cog(commands.Cog):
@commands.slash_command()
async def a(self, _) -> None: ...
@a.sub_command()
async def sub(self, _) -> None: ...
@a.sub_command_group()
... | (cog.group, cog.a) | assert | collection | tests/ext/commands/test_slash_core.py | test_parents | TestParents | 50 | null |
DisnakeDev/disnake | from __future__ import annotations
import re
import pytest
from disnake import flags
class TestFlagValue:
def test_flag_value_or(self) -> None:
ins = TestFlags.four | TestFlags.one
assert isinstance(ins, TestFlags)
assert ins.value == 5
assert (TestFlags.two | ins).value == 7
... | 1 | assert | numeric_literal | tests/test_flags.py | test_flag_value_or | TestFlagValue | 120 | null |
DisnakeDev/disnake | from __future__ import annotations
import contextlib
from collections.abc import Iterator
from typing import Any, TypeVar
import pytest
from typing_extensions import assert_type
from disnake import ui
from disnake.ui.button import V_co
V = TypeVar("V", bound=ui.View)
I = TypeVar("I", bound=ui.Item)
def create_call... | ui.Button[Any] | assert | complex_expr | tests/ui/test_decorators.py | test_default | TestDecorator | 45 | null |
taverntesting/tavern | from unittest.mock import Mock, patch
import pytest
from gql import FileVar
from tavern._core import exceptions
from tavern._plugins.graphql.client import GraphQLClient, GraphQLResponseLike
from tavern._plugins.graphql.request import GraphQLRequest, get_file_arguments
class TestGraphQLRequest:
def test_init_vali... | "query { hello }" | assert | string_literal | tests/unit/plugins/graphql/test_graphql_request.py | test_init_valid_request | TestGraphQLRequest | 23 | null |
taverntesting/tavern | import dataclasses
import logging
import unittest.mock
from collections.abc import Mapping
from unittest.mock import patch
import pytest
from tavern._core import exceptions
from tavern._core.pytest.config import TestConfig
from tavern._core.run import run_test
def _run_test(
stage: Mapping, test_block_config: Te... | False | assert | bool_literal | tests/unit/test_skip.py | test_skip_true | TestSkipStage | 51 | null |
taverntesting/tavern | import ast
import pytest
from tavern._core import exceptions
from tavern._core.pytest.file import _ast_node_to_literal, _format_test_marks
class TestAstNodeToLiteral:
def test_constant_node(self):
"""Test converting ast.Constant nodes"""
# Test string constant
node = ast.Constant(value=... | True | assert | bool_literal | tests/unit/test_marks.py | test_constant_node | TestAstNodeToLiteral | 116 | null |
taverntesting/tavern | import contextlib
import json
import sys
import tempfile
from textwrap import dedent
from unittest.mock import Mock, patch
import _pytest
import pytest
import yaml
from box import Box
from tavern._core import exceptions
from tavern._core.dict_util import _check_and_format_values, format_keys
from tavern._core.loader ... | exceptions.JMESError) | pytest.raises | complex_expr | tests/unit/test_helpers.py | test_incorrect_jmes_path | TestContent | 238 | null |
taverntesting/tavern | import ast
import pytest
from tavern._core import exceptions
from tavern._core.pytest.file import _ast_node_to_literal, _format_test_marks
class TestAstNodeToLiteral:
def test_tuple_node(self):
"""Test converting ast.Tuple nodes"""
# Empty tuple
node = ast.Tuple(elts=[], ctx=ast.Load())... | ("outer", ("nested",)) | assert | collection | tests/unit/test_marks.py | test_tuple_node | TestAstNodeToLiteral | 225 | null |
taverntesting/tavern | import dataclasses
import logging
import os.path
import pathlib
import re
import typing
import uuid
from abc import abstractmethod
from itertools import chain
from typing import Optional
import pytest
import yaml
from _pytest.python_api import ApproxBase
from yaml.composer import Composer
from yaml.constructor import ... | val) | pytest.approx | variable | tavern/_core/loader.py | from_yaml | ApproxSentinel | 429 | null |
taverntesting/tavern | import dataclasses
from tavern._plugins.graphql import tavernhook
from tavern._plugins.graphql.client import GraphQLClient
class TestTavernGraphQLPlugin:
def test_get_expected_from_request_with_variables(self, graphql_test_block_config):
response_block = {"status_code": 200, "data": {"user_id": "{user_id... | { "graphql_responses": [{"status_code": 200, "data": {"user_id": "123"}}] } | assert | collection | tests/unit/plugins/graphql/test_graphql_tavernhook.py | test_get_expected_from_request_with_variables | TestTavernGraphQLPlugin | 48 | null |
taverntesting/tavern | import copy
import dataclasses
import json
import os
import uuid
from copy import deepcopy
from unittest.mock import MagicMock, Mock, patch
import paho.mqtt.client as paho
import pytest
import requests
from tavern._core import exceptions
from tavern._core.pytest.util import load_global_cfg
from tavern._core.run impor... | "http://www.bing.com" | assert | string_literal | tests/unit/test_core.py | check_mocks_called | TestIncludeStages | 143 | null |
taverntesting/tavern | import ast
import pytest
from tavern._core import exceptions
from tavern._core.pytest.file import _ast_node_to_literal, _format_test_marks
class TestAstNodeToLiteral:
def test_constant_node(self):
"""Test converting ast.Constant nodes"""
# Test string constant
node = ast.Constant(value=... | "test_string" | assert | string_literal | tests/unit/test_marks.py | test_constant_node | TestAstNodeToLiteral | 106 | null |
taverntesting/tavern | from unittest.mock import Mock
import requests
from tavern._plugins.graphql.client import GraphQLClient
from tavern._plugins.graphql.response import GraphQLResponse
class TestGraphQLResponse:
def test_init_defaults(self, graphql_test_block_config):
session = Mock(spec=GraphQLClient)
expected = {}... | 200 | assert | numeric_literal | tests/unit/plugins/graphql/test_graphql_response.py | test_init_defaults | TestGraphQLResponse | 16 | null |
taverntesting/tavern | import ast
import pytest
from tavern._core import exceptions
from tavern._core.pytest.file import _ast_node_to_literal, _format_test_marks
class TestAstNodeToLiteral:
def test_list_node(self):
"""Test converting ast.List nodes"""
# Empty list
node = ast.List(elts=[], ctx=ast.Load())
... | [] | assert | collection | tests/unit/test_marks.py | test_list_node | TestAstNodeToLiteral | 129 | null |
taverntesting/tavern | import copy
import dataclasses
import json
import os
import uuid
from copy import deepcopy
from unittest.mock import MagicMock, Mock, patch
import paho.mqtt.client as paho
import pytest
import requests
from tavern._core import exceptions
from tavern._core.pytest.util import load_global_cfg
from tavern._core.run impor... | exceptions.TestFailError) | pytest.raises | complex_expr | tests/unit/test_core.py | test_repeats_twice_and_fails | TestRetry | 268 | null |
taverntesting/tavern | import pytest
from tavern._core import exceptions
from tavern._core.schema.extensions import (
validate_grpc_status_is_valid_or_list_of_names as validate_grpc,
)
class TestGrpcCodes:
@pytest.mark.parametrize("code", ("UNAVAILABLE", "unavailable", "ok", 14, 0))
def test_validate_grpc_valid_status(self, cod... | validate_grpc([code], None, None) | assert | func_call | tests/unit/test_extensions.py | test_validate_grpc_valid_status | TestGrpcCodes | 13 | null |
taverntesting/tavern | import dataclasses
import os
import tempfile
from contextlib import ExitStack
from textwrap import dedent
from unittest.mock import Mock
import pytest
import requests
import yaml
from requests.cookies import RequestsCookieJar
from tavern._core import exceptions
from tavern._core.extfunctions import update_from_ext
fr... | tmpin.name | assert | complex_expr | tests/unit/test_request.py | test_file_body_format | TestFileBody | 356 | null |
taverntesting/tavern | from unittest.mock import Mock, patch
import pytest
from tavern._core import exceptions
from tavern._core.dict_util import format_keys
from tavern._core.loader import ANYTHING
from tavern._plugins.rest.response import RestResponse
def fix_example_response():
spec = {
"status_code": 302,
"headers"... | {"next_location": example_response["headers"]["location"]} | assert | collection | tests/unit/response/test_rest.py | test_save_header | TestSave | 102 | null |
taverntesting/tavern | import ast
import pytest
from tavern._core import exceptions
from tavern._core.pytest.file import _ast_node_to_literal, _format_test_marks
class TestAstNodeToLiteral:
def test_tuple_node(self):
"""Test converting ast.Tuple nodes"""
# Empty tuple
node = ast.Tuple(elts=[], ctx=ast.Load())... | ("a", 1, True) | assert | collection | tests/unit/test_marks.py | test_tuple_node | TestAstNodeToLiteral | 216 | null |
taverntesting/tavern | import copy
import dataclasses
import json
import os
import uuid
from copy import deepcopy
from unittest.mock import MagicMock, Mock, patch
import paho.mqtt.client as paho
import pytest
import requests
from tavern._core import exceptions
from tavern._core.pytest.util import load_global_cfg
from tavern._core.run impor... | None | assert | none_literal | tests/unit/test_core.py | test_copy_config | 668 | null | |
taverntesting/tavern | from unittest.mock import Mock
import requests
from tavern._plugins.graphql.client import GraphQLClient
from tavern._plugins.graphql.response import GraphQLResponse
class TestGraphQLResponse:
def test_init_custom_status_code(self, graphql_test_block_config):
session = Mock(spec=GraphQLClient)
ex... | 201 | assert | numeric_literal | tests/unit/plugins/graphql/test_graphql_response.py | test_init_custom_status_code | TestGraphQLResponse | 24 | null |
taverntesting/tavern | import dataclasses
from tavern._plugins.graphql import tavernhook
from tavern._plugins.graphql.client import GraphQLClient
class TestTavernGraphQLPlugin:
def test_plugin_properties(self):
assert tavernhook.session_type == GraphQLClient
assert tavernhook.request_block_name == "graphql_request"
... | "graphql_response" | assert | string_literal | tests/unit/plugins/graphql/test_graphql_tavernhook.py | test_plugin_properties | TestTavernGraphQLPlugin | 11 | null |
taverntesting/tavern | import dataclasses
import os
import tempfile
from contextlib import ExitStack
from textwrap import dedent
from unittest.mock import Mock
import pytest
import requests
import yaml
from requests.cookies import RequestsCookieJar
from tavern._core import exceptions
from tavern._core.extfunctions import update_from_ext
fr... | "GET" | assert | string_literal | tests/unit/test_request.py | test_default_method | TestRequestArgs | 193 | null |
taverntesting/tavern | from unittest.mock import patch
import pytest
from tavern._core.tincture import Tinctures, get_stage_tinctures
def example():
spec = {
"test_name": "A test with a single stage",
"stages": [
{
"name": "step 1",
"request": {"url": "http://www.google.com",... | len(tinctures) | assert | func_call | tests/unit/test_tinctures.py | test_stage_tinctures_normal | TestTinctureBasic | 58 | null |
taverntesting/tavern | import contextlib
import copy
import os
import tempfile
from collections import OrderedDict
from textwrap import dedent
from unittest.mock import Mock, patch
import pytest
import yaml
from tavern._core import exceptions
from tavern._core.dict_util import (
check_keys_match_recursive,
deep_dict_merge,
form... | expected_value | assert | variable | tests/unit/test_utilities.py | assert_type_value | TestCustomTokens | 325 | null |
taverntesting/tavern | import ast
import pytest
from tavern._core import exceptions
from tavern._core.pytest.file import _ast_node_to_literal, _format_test_marks
class TestAstNodeToLiteral:
def test_dict_node(self):
"""Test converting ast.Dict nodes"""
# Empty dict
node = ast.Dict(keys=[], values=[], ctx=ast.... | {} | assert | collection | tests/unit/test_marks.py | test_dict_node | TestAstNodeToLiteral | 158 | null |
taverntesting/tavern | import contextlib
import json
import sys
import tempfile
from textwrap import dedent
from unittest.mock import Mock, patch
import _pytest
import pytest
import yaml
from box import Box
from tavern._core import exceptions
from tavern._core.dict_util import _check_and_format_values, format_keys
from tavern._core.loader ... | exceptions.BadSchemaError) | pytest.raises | complex_expr | tests/unit/test_helpers.py | test_validate_schema_incorrect | TestPykwalifyExtension | 288 | null |
taverntesting/tavern | import ast
import pytest
from tavern._core import exceptions
from tavern._core.pytest.file import _ast_node_to_literal, _format_test_marks
class TestAstNodeToLiteral:
def test_name_node_constants(self):
"""Test converting ast.Name nodes for constants"""
# Test True
node = ast.Name(id="T... | False | assert | bool_literal | tests/unit/test_marks.py | test_name_node_constants | TestAstNodeToLiteral | 238 | null |
taverntesting/tavern | import pytest
from tavern._core.strict_util import StrictOption, StrictSetting, extract_strict_setting
@pytest.mark.parametrize(
"strict", [True, StrictSetting.ON, StrictOption("json", StrictSetting.ON)]
)
def test_extract_strict_setting_true(strict):
as_bool, as_setting = extract_strict_setting(strict)
a... | strict.setting | assert | complex_expr | tests/unit/test_strict_util.py | test_extract_strict_setting_true | 15 | null | |
taverntesting/tavern | import contextlib
import copy
import os
import tempfile
from collections import OrderedDict
from textwrap import dedent
from unittest.mock import Mock, patch
import pytest
import yaml
from tavern._core import exceptions
from tavern._core.dict_util import (
check_keys_match_recursive,
deep_dict_merge,
form... | load_single_document_yaml(f) | assert | func_call | tests/unit/test_utilities.py | test_load_one | TestLoadCfg | 402 | null |
taverntesting/tavern | import time
from unittest.mock import MagicMock, Mock, patch
import paho.mqtt.client as paho
import pytest
from tavern._core import exceptions
from tavern._plugins.mqtt.client import MQTTClient, _handle_tls_args, _Subscription
from tavern._plugins.mqtt.request import MQTTRequest
def fix_fake_client():
args = {"c... | exceptions.MissingFormatError) | pytest.raises | complex_expr | tests/unit/test_mqtt.py | test_missing_format | TestRequests | 189 | null |
taverntesting/tavern | import contextlib
import copy
import os
import tempfile
from collections import OrderedDict
from textwrap import dedent
from unittest.mock import Mock, patch
import pytest
import yaml
from tavern._core import exceptions
from tavern._core.dict_util import (
check_keys_match_recursive,
deep_dict_merge,
form... | exceptions.BadSchemaError) | pytest.raises | complex_expr | tests/unit/test_utilities.py | test_get_invalid_module | TestValidateFunctions | 71 | null |
taverntesting/tavern | import dataclasses
import os
import tempfile
from contextlib import ExitStack
from textwrap import dedent
from unittest.mock import Mock
import pytest
import requests
import yaml
from requests.cookies import RequestsCookieJar
from tavern._core import exceptions
from tavern._core.extfunctions import update_from_ext
fr... | "abc123" | assert | string_literal | tests/unit/test_request.py | test_use_long_form_content_type | TestGetFiles | 445 | null |
taverntesting/tavern | import contextlib
import json
import sys
import tempfile
from textwrap import dedent
from unittest.mock import Mock, patch
import _pytest
import pytest
import yaml
from box import Box
from tavern._core import exceptions
from tavern._core.dict_util import _check_and_format_values, format_keys
from tavern._core.loader ... | [optval] | assert | collection | tests/unit/test_helpers.py | test_strictness_parsing_good | TestOptionParsing | 131 | null |
taverntesting/tavern | import dataclasses
import os
import tempfile
from contextlib import ExitStack
from textwrap import dedent
from unittest.mock import Mock
import pytest
import requests
import yaml
from requests.cookies import RequestsCookieJar
from tavern._core import exceptions
from tavern._core.extfunctions import update_from_ext
fr... | verify | assert | variable | tests/unit/test_request.py | test_passthrough_verify | TestOptionalDefaults | 339 | null |
taverntesting/tavern | import pytest
from tavern._core.strict_util import StrictOption, StrictSetting, extract_strict_setting
@pytest.mark.parametrize(
"strict", [True, StrictSetting.ON, StrictOption("json", StrictSetting.ON)]
)
def test_extract_strict_setting_true(strict):
as_bool, as_setting = extract_strict_setting(strict)
a... | strict | assert | variable | tests/unit/test_strict_util.py | test_extract_strict_setting_true | 13 | null | |
taverntesting/tavern | import dataclasses
from tavern._plugins.graphql import tavernhook
from tavern._plugins.graphql.client import GraphQLClient
class TestTavernGraphQLPlugin:
def test_plugin_properties(self):
assert tavernhook.session_type == | GraphQLClient | assert | variable | tests/unit/plugins/graphql/test_graphql_tavernhook.py | test_plugin_properties | TestTavernGraphQLPlugin | 9 | null |
taverntesting/tavern | from unittest.mock import patch
import pytest
from tavern._core.tincture import Tinctures, get_stage_tinctures
def example():
spec = {
"test_name": "A test with a single stage",
"stages": [
{
"name": "step 1",
"request": {"url": "http://www.google.com",... | "step 1" | assert | string_literal | tests/unit/test_tinctures.py | does_yield | TestTinctureYields | 78 | null |
taverntesting/tavern | import contextlib
import json
import sys
import tempfile
from textwrap import dedent
from unittest.mock import Mock, patch
import _pytest
import pytest
import yaml
from box import Box
from tavern._core import exceptions
from tavern._core.dict_util import _check_and_format_values, format_keys
from tavern._core.loader ... | args | assert | variable | tests/unit/test_helpers.py | test_strictness_parsing_good | TestOptionParsing | 130 | null |
taverntesting/tavern | from unittest.mock import Mock, patch
import pytest
from tavern._core import exceptions
from tavern._core.dict_util import format_keys
from tavern._core.loader import ANYTHING
from tavern._plugins.rest.response import RestResponse
def fix_example_response():
spec = {
"status_code": 302,
"headers"... | {"test_search": "breadsticks"} | assert | collection | tests/unit/response/test_rest.py | test_save_redirect_query_param | TestSave | 114 | null |
taverntesting/tavern | from unittest.mock import Mock
import requests
from tavern._plugins.graphql.client import GraphQLClient
from tavern._plugins.graphql.response import GraphQLResponse
class TestGraphQLResponse:
def test_str_with_response(self, graphql_test_block_config):
session = Mock(spec=GraphQLClient)
expected... | '{"data": {"hello": "world"}}' | assert | string_literal | tests/unit/plugins/graphql/test_graphql_response.py | test_str_with_response | TestGraphQLResponse | 44 | null |
taverntesting/tavern | import dataclasses
import os
import tempfile
from contextlib import ExitStack
from textwrap import dedent
from unittest.mock import Mock
import pytest
import requests
import yaml
from requests.cookies import RequestsCookieJar
from tavern._core import exceptions
from tavern._core.extfunctions import update_from_ext
fr... | False | assert | bool_literal | tests/unit/test_request.py | test_session_called_no_redirects | TestHttpRedirects | 74 | null |
taverntesting/tavern | import copy
import dataclasses
import json
import os
import uuid
from copy import deepcopy
from unittest.mock import MagicMock, Mock, patch
import paho.mqtt.client as paho
import pytest
import requests
from tavern._core import exceptions
from tavern._core.pytest.util import load_global_cfg
from tavern._core.run impor... | len(tinctures) | assert | func_call | tests/unit/test_core.py | test_tinctures | TestTinctures | 658 | null |
taverntesting/tavern | import ast
import pytest
from tavern._core import exceptions
from tavern._core.pytest.file import _ast_node_to_literal, _format_test_marks
class TestAstNodeToLiteral:
def test_unsupported_node_type_error(self):
"""Test that unsupported node types raise ValueError"""
# Use ast.Expr as an example... | ValueError, match="Unsupported AST node type: <class 'ast.Expr'>") | pytest.raises | complex_expr | tests/unit/test_marks.py | test_unsupported_node_type_error | TestAstNodeToLiteral | 259 | null |
taverntesting/tavern | import time
from unittest.mock import MagicMock, Mock, patch
import paho.mqtt.client as paho
import pytest
from tavern._core import exceptions
from tavern._plugins.mqtt.client import MQTTClient, _handle_tls_args, _Subscription
from tavern._plugins.mqtt.request import MQTTRequest
def fix_fake_client():
args = {"c... | None | assert | none_literal | tests/unit/test_mqtt.py | test_no_message | TestClient | 44 | null |
taverntesting/tavern | from unittest.mock import Mock, patch
import pytest
from gql import FileVar
from tavern._core import exceptions
from tavern._plugins.graphql.client import GraphQLClient, GraphQLResponseLike
from tavern._plugins.graphql.request import GraphQLRequest, get_file_arguments
class TestGraphQLFileUploads:
def test_get_... | result | assert | variable | tests/unit/plugins/graphql/test_graphql_request.py | test_get_file_arguments_single_file | TestGraphQLFileUploads | 117 | null |
taverntesting/tavern | import dataclasses
from tavern._plugins.graphql import tavernhook
from tavern._plugins.graphql.client import GraphQLClient
class TestTavernGraphQLPlugin:
def test_get_expected_from_request_with_response(self, graphql_test_block_config):
response_block = {"status_code": 200}
session = GraphQLClien... | {"graphql_responses": [{"status_code": 200}]} | assert | collection | tests/unit/plugins/graphql/test_graphql_tavernhook.py | test_get_expected_from_request_with_response | TestTavernGraphQLPlugin | 21 | null |
taverntesting/tavern | import contextlib
import json
import sys
import tempfile
from textwrap import dedent
from unittest.mock import Mock, patch
import _pytest
import pytest
import yaml
from box import Box
from tavern._core import exceptions
from tavern._core.dict_util import _check_and_format_values, format_keys
from tavern._core.loader ... | item | assert | variable | tests/unit/test_helpers.py | test_custom_format | TestFormatWithJson | 354 | null |
taverntesting/tavern | import contextlib
import json
import sys
import tempfile
from textwrap import dedent
from unittest.mock import Mock, patch
import _pytest
import pytest
import yaml
from box import Box
from tavern._core import exceptions
from tavern._core.dict_util import _check_and_format_values, format_keys
from tavern._core.loader ... | expected[-1] | assert | complex_expr | tests/unit/test_helpers.py | test_in_jmespath | TestRegex | 77 | null |
taverntesting/tavern | import ast
import pytest
from tavern._core import exceptions
from tavern._core.pytest.file import _ast_node_to_literal, _format_test_marks
class TestAstNodeToLiteral:
def test_tuple_node(self):
"""Test converting ast.Tuple nodes"""
# Empty tuple
node = ast.Tuple(elts=[], ctx=ast.Load())... | () | assert | collection | tests/unit/test_marks.py | test_tuple_node | TestAstNodeToLiteral | 204 | null |
taverntesting/tavern | import ast
import pytest
from tavern._core import exceptions
from tavern._core.pytest.file import _ast_node_to_literal, _format_test_marks
class TestAstNodeToLiteral:
def test_list_node(self):
"""Test converting ast.List nodes"""
# Empty list
node = ast.List(elts=[], ctx=ast.Load())
... | ["a", 1, True] | assert | collection | tests/unit/test_marks.py | test_list_node | TestAstNodeToLiteral | 141 | null |
taverntesting/tavern | import contextlib
import copy
import os
import tempfile
from collections import OrderedDict
from textwrap import dedent
from unittest.mock import Mock, patch
import pytest
import yaml
from tavern._core import exceptions
from tavern._core.dict_util import (
check_keys_match_recursive,
deep_dict_merge,
form... | exceptions.KeyMismatchError) | pytest.raises | complex_expr | tests/unit/test_utilities.py | test_match_dict_mismatch | TestMatchRecursive | 136 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.