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
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...
final_value
assert
variable
tests/unit/test_utilities.py
test_format_success
TestFormatKeys
355
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.JMESError)
pytest.raises
complex_expr
tests/unit/test_utilities.py
test_search_old_style
TestRecurseAccess
384
null
taverntesting/tavern
import random import re import threading from unittest.mock import Mock, patch import pytest from tavern._core import exceptions from tavern._core.loader import ANYTHING from tavern._core.strict_util import StrictLevel from tavern._plugins.mqtt.client import MQTTClient from tavern._plugins.mqtt.response import MQTTRe...
2
assert
numeric_literal
tests/unit/response/test_mqtt_response.py
test_multiple_messages
TestResponse
224
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.MQTTTLSError)
pytest.raises
complex_expr
tests/unit/test_mqtt.py
test_missing_cert_gives_error
TestTLS
150
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...
message
assert
variable
tests/unit/test_mqtt.py
test_message_queued
TestClient
52
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"...
exceptions.TestFailError)
pytest.raises
complex_expr
tests/unit/response/test_rest.py
test_incorrect_status_code
TestFull
337
null
taverntesting/tavern
import asyncio from unittest.mock import AsyncMock, Mock, patch import gql import pytest from gql.transport.aiohttp import AIOHTTPTransport from tavern._plugins.graphql.client import ClientCacheKey, GraphQLClient class TestClientCaching: def test_make_request_creates_new_client(self): """Test that first...
1
assert
numeric_literal
tests/unit/plugins/graphql/test_graphql_client.py
test_make_request_creates_new_client
TestClientCaching
258
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...
3
assert
numeric_literal
tests/unit/test_core.py
test_finally_run_twice
TestFinally
588
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_request_...
None
assert
none_literal
tests/unit/plugins/graphql/test_graphql_request.py
test_request_vars_defaults
TestGraphQLRequest
53
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...
do_follow
assert
variable
tests/unit/test_request.py
test_session_do_follow_redirects_based_on_test
TestHttpRedirects
82
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...
"http://example.com/graphql"
assert
string_literal
tests/unit/plugins/graphql/test_graphql_request.py
test_init_valid_request
TestGraphQLRequest
22
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 @pytest.mark.parametrize( "invalid_marks", [ ["invalid(mark)"], # nonexistent mark name ["xdist_group('unclosed)"], # Invalid string literal ["x...
exceptions.BadSchemaError)
pytest.raises
complex_expr
tests/unit/test_marks.py
test_failing_format_marks
93
null
taverntesting/tavern
import os import pathlib from dataclasses import dataclass from unittest.mock import Mock, patch import pytest from faker import Faker from tavern._core import exceptions from tavern._core.pytest.file import YamlFile, _get_parametrized_items def mock_args(): """Get a basic test config to initialise a YamlFile ob...
12
assert
numeric_literal
tests/unit/test_pytest_hooks.py
test_double_double
TestMakeFile
137
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...
{"name": "world"}
assert
collection
tests/unit/plugins/graphql/test_graphql_request.py
test_init_valid_request
TestGraphQLRequest
24
null
taverntesting/tavern
import random import re import threading from unittest.mock import Mock, patch import pytest from tavern._core import exceptions from tavern._core.loader import ANYTHING from tavern._core.strict_util import StrictLevel from tavern._plugins.mqtt.client import MQTTClient from tavern._plugins.mqtt.response import MQTTRe...
fake_message.topic
assert
complex_expr
tests/unit/response/test_mqtt_response.py
test_message_on_same_topic_fails
TestResponse
102
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_nested_thing": example_response["json"]["nested"]["subthing"][0] }
assert
collection
tests/unit/response/test_rest.py
test_save_body_nested_list
TestSave
88
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...
10.0)
assert_*
numeric_literal
tests/unit/test_utilities.py
test_conversion
TestCustomTokens
331
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 @pytest.mark.parametrize( "marks,expected", [ (["skip"], ([pytest.mark.skip], [])), (["xfail"], ([pytest.mark.xfail], [])), (["slow"], ([pytest.ma...
expected
assert
variable
tests/unit/test_marks.py
test_format_test_marks
81
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...
KeyError)
pytest.raises
variable
tests/unit/test_request.py
test_no_default_content_type
TestRequestArgs
223
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
12
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....
{"key1": "value1", "key2": 2}
assert
collection
tests/unit/test_marks.py
test_dict_node
TestAstNodeToLiteral
173
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) ...
True
assert
bool_literal
tests/unit/test_strict_util.py
test_extract_strict_setting_true
11
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 ...
section
assert
variable
tests/unit/test_helpers.py
test_parse_option
TestStrictUtils
404
null
taverntesting/tavern
import contextlib import dataclasses import pathlib import tempfile from collections.abc import Callable, Generator from typing import Any from unittest.mock import Mock import pytest import yaml from tavern._core import exceptions from tavern._core.pytest.file import YamlFile from tavern._core.pytest.item import Yam...
exception)
pytest.raises
variable
tests/unit/test_files.py
test_reraise_exception
TestGenerateFiles
107
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",...
None
assert
none_literal
tests/unit/test_tinctures.py
does_yield
TestTinctureYields
83
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...
"GET"
assert
string_literal
tests/unit/test_core.py
test_before_every_request_hook_called
TestHooks
696
null
taverntesting/tavern
import os import pathlib from dataclasses import dataclass from unittest.mock import Mock, patch import pytest from faker import Faker from tavern._core import exceptions from tavern._core.pytest.file import YamlFile, _get_parametrized_items def mock_args(): """Get a basic test config to initialise a YamlFile ob...
exceptions.BadSchemaError)
pytest.raises
complex_expr
tests/unit/test_pytest_hooks.py
test_ext_function_top_level_invalid
TestMakeFile
211
null
taverntesting/tavern
import contextlib import os import tempfile from textwrap import dedent import pytest import yaml from tavern._core.exceptions import BadSchemaError from tavern._core.loader import load_single_document_yaml from tavern._core.schema.files import verify_tests def fix_test_dict(): text = dedent( """ ---...
BadSchemaError)
pytest.raises
variable
tests/unit/test_schema.py
test_header_request_list
TestHeaders
65
null
taverntesting/tavern
import random import re import threading from unittest.mock import Mock, patch import pytest from tavern._core import exceptions from tavern._core.loader import ANYTHING from tavern._core.strict_util import StrictLevel from tavern._plugins.mqtt.client import MQTTClient from tavern._plugins.mqtt.response import MQTTRe...
1
assert
numeric_literal
tests/unit/response/test_mqtt_response.py
test_message_on_same_topic_fails
TestResponse
101
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...
request_args["url"]
assert
complex_expr
tests/unit/test_core.py
test_before_every_request_hook_called
TestHooks
697
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_run_...
call_args.kwargs
assert
complex_expr
tests/unit/plugins/graphql/test_graphql_request.py
test_run_with_files_parameter
TestGraphQLFileUploads
203
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 test_host_required(): """Alwa...
exceptions.MissingKeysError)
pytest.raises
complex_expr
tests/unit/test_mqtt.py
test_host_required
14
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 ...
StrictSetting.UNSET
assert
complex_expr
tests/unit/test_helpers.py
test_unset
TestStrictUtils
460
null
taverntesting/tavern
import asyncio from unittest.mock import AsyncMock, Mock, patch import gql import pytest from gql.transport.aiohttp import AIOHTTPTransport from tavern._plugins.graphql.client import ClientCacheKey, GraphQLClient class TestClientCaching: def test_make_request_different_urls_create_different_clients(self): ...
2
assert
numeric_literal
tests/unit/plugins/graphql/test_graphql_client.py
test_make_request_different_urls_create_different_clients
TestClientCaching
348
null
taverntesting/tavern
import random import re import threading from unittest.mock import Mock, patch import pytest from tavern._core import exceptions from tavern._core.loader import ANYTHING from tavern._core.strict_util import StrictLevel from tavern._plugins.mqtt.client import MQTTClient from tavern._plugins.mqtt.response import MQTTRe...
expecteds[i]["topic"]
assert
complex_expr
tests/unit/response/test_mqtt_response.py
test_ext_function_called_save
TestResponse
165
null
taverntesting/tavern
import contextlib import dataclasses import pathlib import tempfile from collections.abc import Callable, Generator from typing import Any from unittest.mock import Mock import pytest import yaml from tavern._core import exceptions from tavern._core.pytest.file import YamlFile from tavern._core.pytest.item import Yam...
expected_name
assert
variable
tests/unit/test_files.py
test_multiple_documents
TestGenerateFiles
84
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_validate_response_format_valid_data(self, graphql_test_block_config): session = Mock(spec=GraphQLClient...
0
assert
numeric_literal
tests/unit/plugins/graphql/test_graphql_response.py
test_validate_response_format_valid_data
TestGraphQLResponse
62
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=...
42
assert
numeric_literal
tests/unit/test_marks.py
test_constant_node
TestAstNodeToLiteral
111
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...
2
assert
numeric_literal
tests/unit/test_core.py
check_mocks_called
TestIncludeStages
141
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_code": example_response["json"]["code"]}
assert
collection
tests/unit/response/test_rest.py
test_save_body
TestSave
60
null
taverntesting/tavern
import pytest from tavern._core.strict_util import StrictOption, StrictSetting, extract_strict_setting @pytest.mark.parametrize( "strict", [ False, StrictSetting.OFF, StrictSetting.LIST_ANY_ORDER, StrictSetting.UNSET, StrictOption("json", StrictSetting.OFF), Non...
False
assert
bool_literal
tests/unit/test_strict_util.py
test_extract_strict_setting_false
31
null
taverntesting/tavern
import datetime import jwt def assert_quick_response(response): """Make sure that a request doesn't take too long Args: response (requests.Response): response object """ assert response.elapsed <
datetime.timedelta(seconds=0.1)
assert
func_call
example/http/tavern_http_example/testing_utils.py
assert_quick_response
12
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.google.com"
assert
string_literal
tests/unit/test_core.py
check_mocks_called
TestIncludeStages
145
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_variable_reference_error(self): """Test that ast.Name nodes for variables raise ValueError""" node = ast.Name...
ValueError, match="Unsupported variable reference: some_variable")
pytest.raises
complex_expr
tests/unit/test_marks.py
test_name_node_variable_reference_error
TestAstNodeToLiteral
249
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 ...
StrictSetting.ON
assert
complex_expr
tests/unit/test_helpers.py
test_set_on
TestStrictUtils
446
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...
request_args
assert
variable
tests/unit/test_core.py
test_before_every_request_hook_called
TestHooks
694
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=...
None
assert
none_literal
tests/unit/test_marks.py
test_constant_node
TestAstNodeToLiteral
121
null
taverntesting/tavern
import random import re import threading from unittest.mock import Mock, patch import pytest from tavern._core import exceptions from tavern._core.loader import ANYTHING from tavern._core.strict_util import StrictLevel from tavern._plugins.mqtt.client import MQTTClient from tavern._plugins.mqtt.response import MQTTRe...
n_messages
assert
variable
tests/unit/response/test_mqtt_response.py
test_ext_function_called_save
TestResponse
158
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...
"gzip"
assert
string_literal
tests/unit/test_request.py
test_file_body_content_encoding
TestFileBody
393
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 ...
type(box["fd"]))
assert_*
func_call
tests/unit/test_helpers.py
test_warns_bad_type_box
TestCheckParseValues
318
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...
False
assert
bool_literal
tests/unit/test_mqtt.py
test_handles_subscriptions
TestSubscription
219
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_without_response( self, graphql_test_block_config ): response_block = None session = GraphQLClie...
None
assert
none_literal
tests/unit/plugins/graphql/test_graphql_tavernhook.py
test_get_expected_from_request_without_response
TestTavernGraphQLPlugin
33
null
taverntesting/tavern
def message_says_hello(msg): """Make sure that the response was friendly""" assert msg.msg.payload.get("message") ==
"hello world"
assert
string_literal
example/mqtt/tavern_mqtt_example/testing_utils.py
message_says_hello
3
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_list_status_code(self, graphql_test_block_config): session = Mock(spec=GraphQLClient) expe...
[200, 201]
assert
collection
tests/unit/plugins/graphql/test_graphql_response.py
test_init_list_status_code
TestGraphQLResponse
32
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...
"abc"
assert
string_literal
tests/unit/test_mqtt.py
test_handles_subscriptions
TestSubscription
218
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_request_...
{}
assert
collection
tests/unit/plugins/graphql/test_graphql_request.py
test_request_vars_defaults
TestGraphQLRequest
52
null
taverntesting/tavern
import os import pathlib from dataclasses import dataclass from unittest.mock import Mock, patch import pytest from faker import Faker from tavern._core import exceptions from tavern._core.pytest.file import YamlFile, _get_parametrized_items def mock_args(): """Get a basic test config to initialise a YamlFile ob...
36
assert
numeric_literal
tests/unit/test_pytest_hooks.py
test_double_double_single
TestMakeFile
156
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...
caplog.text
assert
complex_expr
tests/unit/test_skip.py
test_skip_invalid_simpleeval
TestSkipStage
107
null
taverntesting/tavern
import os import pathlib from dataclasses import dataclass from unittest.mock import Mock, patch import pytest from faker import Faker from tavern._core import exceptions from tavern._core.pytest.file import YamlFile, _get_parametrized_items def mock_args(): """Get a basic test config to initialise a YamlFile ob...
len(values)
assert
func_call
tests/unit/test_pytest_hooks.py
test_ext_function_top_level
TestMakeFile
181
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.MQTTError)
pytest.raises
complex_expr
tests/unit/test_mqtt.py
test_no_subscribe_on_err
TestSubscription
227
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"
assert
string_literal
tests/unit/plugins/graphql/test_graphql_tavernhook.py
test_plugin_properties
TestTavernGraphQLPlugin
10
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", (-1, "fo", "J", {"status": "OK"})) def test_validate_grpc_invalid_status(self, code): ...
exceptions.BadSchemaError)
pytest.raises
complex_expr
tests/unit/test_extensions.py
test_validate_grpc_invalid_status
TestGrpcCodes
17
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...
"ECDHE-RSA-AES256-GCM-SHA384")
assert_*
string_literal
tests/unit/test_mqtt.py
test_ciphers_set_correctly
TestSSLContext
296
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.RegexAccessError)
pytest.raises
complex_expr
tests/unit/test_helpers.py
test_regex_no_match
TestRegex
44
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_data
assert
variable
tests/unit/test_utilities.py
test_search_old_style
TestRecurseAccess
388
null
taverntesting/tavern
import os import pathlib from dataclasses import dataclass from unittest.mock import Mock, patch import pytest from faker import Faker from tavern._core import exceptions from tavern._core.pytest.file import YamlFile, _get_parametrized_items def mock_args(): """Get a basic test config to initialise a YamlFile ob...
3
assert
numeric_literal
tests/unit/test_pytest_hooks.py
test_only_single
TestMakeFile
89
null
taverntesting/tavern
import random import re import threading from unittest.mock import Mock, patch import pytest from tavern._core import exceptions from tavern._core.loader import ANYTHING from tavern._core.strict_util import StrictLevel from tavern._plugins.mqtt.client import MQTTClient from tavern._plugins.mqtt.response import MQTTRe...
received_topics
assert
variable
tests/unit/response/test_mqtt_response.py
test_correct_message_eventually
TestResponse
183
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_validate_response_format_invalid_no_data_or_errors( self, graphql_test_block_config ): sess...
response.errors[0]
assert
complex_expr
tests/unit/plugins/graphql/test_graphql_response.py
test_validate_response_format_invalid_no_data_or_errors
TestGraphQLResponse
86
null
taverntesting/tavern
import os import pathlib from dataclasses import dataclass from unittest.mock import Mock, patch import pytest from faker import Faker from tavern._core import exceptions from tavern._core.pytest.file import YamlFile, _get_parametrized_items def mock_args(): """Get a basic test config to initialise a YamlFile ob...
27
assert
numeric_literal
tests/unit/test_pytest_hooks.py
test_only_basic
TestMakeFile
106
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_nested_thing": example_response["json"]["nested"]["subthing"] }
assert
collection
tests/unit/response/test_rest.py
test_save_body_nested
TestSave
73
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",...
stage["response"]
assert
complex_expr
tests/unit/test_tinctures.py
does_yield
TestTinctureYields
82
null
taverntesting/tavern
import contextlib import dataclasses import pathlib import tempfile from collections.abc import Callable, Generator from typing import Any from unittest.mock import Mock import pytest import yaml from tavern._core import exceptions from tavern._core.pytest.file import YamlFile from tavern._core.pytest.item import Yam...
3
assert
numeric_literal
tests/unit/test_files.py
test_multiple_documents
TestGenerateFiles
79
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...
exceptions.EvalError)
pytest.raises
complex_expr
tests/unit/test_skip.py
test_skip_invalid_var_types
TestSkipStage
93
null
hacs/integration
import pytest from custom_components.hacs.utils.decorator import return_none_on_exception def test_sync_function_no_exception(): """Test that a synchronous function returning a value works normally.""" @return_none_on_exception def test_func(): return "test_value" assert test_func() ==
"test_value"
assert
string_literal
tests/utils/test_decorator.py
test_sync_function_no_exception
13
null
hacs/integration
from collections.abc import Generator from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect import pytest from custom_components.hacs.enums import HacsCategory, HacsDispatchEvent from tests.common import WSClient, get_hacs, recursive_remove_key, safe_json_...
f"{repository_full_name}/test_register_repository.json")
assert_*
string_literal
tests/repositories/test_register_repository.py
test_register_repository
44
null
hacs/integration
import pytest from custom_components.hacs.base import HacsRepositories from custom_components.hacs.enums import HacsCategory async def test_hacs(hacs, repository, tmpdir): hacs.hass.config.config_dir = tmpdir hacs.repositories = HacsRepositories() assert hacs.repositories.get_by_id(None) is
None
assert
none_literal
tests/hacsbase/test_hacs.py
test_hacs
12
null
hacs/integration
import json import os from unittest import mock import pytest from tests.common import TOKEN, MockedResponse, ResponseMocker, current_function_name from tests.conftest import SnapshotFixture @pytest.mark.parametrize( "test_case", [ pytest.param( { "manifest": {"documentati...
f"action/{current_function_name()}/{request.node.callspec.id}.log")
assert_*
string_literal
tests/action/test_hacs_action_integration.py
test_hacs_action_integration
118
null
hacs/integration
from custom_components.hacs.repositories.base import RepositoryData def test_guarded(): data = RepositoryData.create_from_dict({"full_name": "test"}) assert data.name ==
"test"
assert
string_literal
tests/helpers/classes/test_repository_data.py
test_guarded
6
null
hacs/integration
from . import patch_time # isort:skip import asyncio from collections.abc import Generator from dataclasses import asdict from glob import iglob import json import logging import os import shutil from typing import Any from unittest.mock import MagicMock, _patch, patch from aiohttp import AsyncResolver from awesomev...
1
assert
numeric_literal
tests/conftest.py
setup_integration
406
null
hacs/integration
from contextlib import nullcontext as does_not_raise import re from awesomeversion import AwesomeVersion import pytest from voluptuous.error import Invalid, MultipleInvalid from custom_components.hacs.utils.validate import ( HACS_MANIFEST_JSON_SCHEMA as hacs_json_schema, INTEGRATION_MANIFEST_JSON_SCHEMA as in...
Invalid, match="extra keys not allowed")
pytest.raises
complex_expr
tests/utils/test_validate.py
test_hacs_manifest_json_schema
82
null
hacs/integration
import asyncio from collections.abc import Generator from unittest.mock import patch from aiogithubapi import GitHubException from freezegun.api import FrozenDateTimeFactory from homeassistant import config_entries from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.core import HomeAssistant from home...
{"token": TOKEN}
assert
collection
tests/test_config_flow.py
test_options_flow
357
null
hacs/integration
import pytest from custom_components.hacs.base import HacsRepositories from custom_components.hacs.enums import HacsCategory async def test_add_remove_repository(hacs, repository, tmpdir): hacs.hass.config.config_dir = tmpdir repository.data.id = "0" hacs.repositories.register(repository) hacs.repos...
ValueError)
pytest.raises
variable
tests/hacsbase/test_hacs.py
test_add_remove_repository
45
null
hacs/integration
from unittest.mock import AsyncMock import pytest from custom_components.hacs.base import HacsBase from custom_components.hacs.exceptions import HacsExecutionStillInProgress from custom_components.hacs.utils.queue_manager import QueueManager dummy_task = AsyncMock() async def test_queue_manager(hacs: HacsBase, capl...
4
assert
numeric_literal
tests/utils/test_queue_manager.py
test_queue_manager
32
null
hacs/integration
import pytest from custom_components.hacs.base import HacsConfiguration from custom_components.hacs.exceptions import HacsException def test_configuration_and_option(): config = HacsConfiguration() config.update_from_dict({"token": "xxxxxxxxxx"}) assert isinstance(config.to_json(), dict) assert isin...
"hacs:hacs"
assert
string_literal
tests/hacsbase/test_configuration.py
test_configuration_and_option
22
null
hacs/integration
import asyncio from contextlib import nullcontext as does_not_raise from typing import ContextManager from homeassistant.core import HomeAssistant import pytest from custom_components.hacs.base import HacsBase from custom_components.hacs.exceptions import HacsException, HacsNotModifiedException from tests.common imp...
"running"
assert
string_literal
tests/test_data_client.py
test_discard_invalid_repo_data
228
null
hacs/integration
import asyncio from contextlib import nullcontext as does_not_raise from typing import ContextManager from homeassistant.core import HomeAssistant import pytest from custom_components.hacs.base import HacsBase from custom_components.hacs.exceptions import HacsException, HacsNotModifiedException from tests.common imp...
f"data_client/base/data/{category_test_data['category']}.json")
assert_*
string_literal
tests/test_data_client.py
test_basic_functionality_data
35
null
hacs/integration
from collections.abc import Generator from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_connect import pytest from custom_components.hacs.enums import HacsCategory, HacsDispatchEvent from tests.common import WSClient, get_hacs, recursive_remove_key, safe_json_...
{}
assert
collection
tests/repositories/test_register_repository.py
test_register_repository_failures
100
null
hacs/integration
from custom_components.hacs.utils.workarounds import DOMAIN_OVERRIDES def test_domain_ovverides() -> None: assert DOMAIN_OVERRIDES.get("custom-components/sensor.custom_aftership") ==
"custom_aftership"
assert
string_literal
tests/utils/test_workarounds.py
test_domain_ovverides
5
null
hacs/integration
from unittest.mock import patch from custom_components.hacs.base import HacsRepositories from custom_components.hacs.enums import HacsGitHubRepo from custom_components.hacs.utils.data import HacsData async def test_hacs_data_restore_write_not_new(hacs, caplog): data = HacsData(hacs) async def _mocked_loads(h...
caplog.text
assert
complex_expr
tests/hacsbase/test_hacsbase_data.py
test_hacs_data_restore_write_not_new
69
null
hacs/integration
import asyncio from collections.abc import Generator from unittest.mock import patch from aiogithubapi import GitHubException from freezegun.api import FrozenDateTimeFactory from homeassistant import config_entries from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.core import HomeAssistant from home...
False
assert
bool_literal
tests/test_config_flow.py
test_options_flow
373
null
hacs/integration
from unittest.mock import AsyncMock, patch from homeassistant.core import HomeAssistant import pytest from custom_components.hacs.const import VERSION_STORAGE from custom_components.hacs.exceptions import HacsException from custom_components.hacs.utils.store import ( async_load_from_store, async_remove_store,...
1
assert
numeric_literal
tests/utils/test_store.py
test_store_store
66
null
hacs/integration
from contextlib import nullcontext as does_not_raise import re from awesomeversion import AwesomeVersion import pytest from voluptuous.error import Invalid, MultipleInvalid from custom_components.hacs.utils.validate import ( HACS_MANIFEST_JSON_SCHEMA as hacs_json_schema, INTEGRATION_MANIFEST_JSON_SCHEMA as in...
expected_errors_1
assert
variable
tests/utils/test_validate.py
test_repo_data_json_schema_multiple_bad_data
657
null
hacs/integration
import pytest from custom_components.hacs.exceptions import HacsException from custom_components.hacs.repositories.base import HacsManifest def test_edge_pass_none(): with pytest.raises(
HacsException)
pytest.raises
variable
tests/repositories/test_hacs_manifest.py
test_edge_pass_none
43
null
hacs/integration
from collections.abc import Generator import json import re from unittest.mock import patch from homeassistant.core import HomeAssistant, HomeAssistantError from homeassistant.helpers.entity_registry import async_get as async_get_entity_registry import pytest from custom_components.hacs.const import DOMAIN from test...
True
assert
bool_literal
tests/repositories/test_update_repository.py
test_update_repository_websocket
86
null
hacs/integration
from collections.abc import Generator import json import re from unittest.mock import patch from homeassistant.core import HomeAssistant, HomeAssistantError from homeassistant.helpers.entity_registry import async_get as async_get_entity_registry import pytest from custom_components.hacs.const import DOMAIN from test...
HomeAssistantError, match=re.escape( "Downloading hacs-test-org/integration-basic with version 2.0.0 failed with (Could not download, see log for details)", ))
pytest.raises
func_call
tests/repositories/test_update_repository.py
test_update_repository_entity_download_failure
255
null
hacs/integration
import pytest from custom_components.hacs.base import HacsConfiguration from custom_components.hacs.exceptions import HacsException def test_configuration_and_option(): config = HacsConfiguration() config.update_from_dict({"token": "xxxxxxxxxx"}) assert isinstance(config.to_json(), dict) assert isin...
"xxxxxxxxxx"
assert
string_literal
tests/hacsbase/test_configuration.py
test_configuration_and_option
16
null
hacs/integration
import pytest from custom_components.hacs.base import HacsConfiguration from custom_components.hacs.exceptions import HacsException def test_configuration_and_option(): config = HacsConfiguration() config.update_from_dict({"token": "xxxxxxxxxx"}) assert isinstance(config.to_json(), dict) assert isin...
5
assert
numeric_literal
tests/hacsbase/test_configuration.py
test_configuration_and_option
37
null
hacs/integration
import pytest from custom_components.hacs.base import HacsRepositories from custom_components.hacs.enums import HacsCategory async def test_add_remove_repository(hacs, repository, tmpdir): hacs.hass.config.config_dir = tmpdir repository.data.id = "0" hacs.repositories.register(repository) hacs.repos...
repository
assert
variable
tests/hacsbase/test_hacs.py
test_add_remove_repository
51
null
hacs/integration
import pytest from custom_components.hacs.base import RemovedRepository BASE_DATA = { "repository": "remmoved/repository", "reason": None, "link": None, "removal_type": None, "acknowledged": False, } @pytest.mark.parametrize( "data", ( {"removal_type": "remove"}, {"reason"...
BASE_DATA
assert
variable
tests/repositories/test_removed_repository.py
test_removed_repository
28
null
hacs/integration
import asyncio import json import os from typing import Any from homeassistant.core import HomeAssistant import pytest from scripts.data.generate_category_data import OUTPUT_DIR, generate_category_data from tests.common import ( FIXTURES_PATH, CategoryTestData, MockedResponse, ResponseMocker, cat...
f"scripts/data/generate_category_data/{ category_test_data['category']}/repositories.json")
assert_*
string_literal
tests/scripts/data/test_generate_category_data.py
test_generate_category_data
120
null