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 |
|---|---|---|---|---|---|---|---|---|---|
mpfaffenberger/code_puppy | import pytest
from code_puppy.command_line.command_registry import (
CommandInfo,
clear_registry,
get_all_commands,
get_command,
get_unique_commands,
register_command,
)
class TestGetAllCommands:
def setup_method(self):
"""Clear registry before each test."""
clear_registry... | 3 | assert | numeric_literal | tests/test_command_registry.py | test_get_all_commands_includes_aliases | TestGetAllCommands | 302 | null |
mpfaffenberger/code_puppy | import os
import pytest
from rich.table import Table
from code_puppy.command_line.utils import list_directory, make_directory_table
class TestListDirectory:
def test_list_directory_only_dirs(self, tmp_path):
"""Test listing directory with only subdirectories."""
(tmp_path / "subdir1").mkdir()
... | 3 | assert | numeric_literal | tests/test_command_line_utils.py | test_list_directory_only_dirs | TestListDirectory | 46 | null |
mpfaffenberger/code_puppy | import base64
import json
import time
from unittest.mock import AsyncMock, MagicMock, Mock, patch
import httpx
import pytest
from code_puppy.claude_cache_client import (
CLAUDE_CLI_USER_AGENT,
TOKEN_MAX_AGE_SECONDS,
TOOL_PREFIX,
ClaudeCacheAsyncClient,
_inject_cache_control_in_payload,
patch_a... | h | assert | variable | tests/test_claude_cache_client_full_coverage.py | test_removes_x_api_key_variants | TestHeaderTransform | 247 | null |
mpfaffenberger/code_puppy | import tempfile
from pathlib import Path
from unittest.mock import patch
from code_puppy.agents import get_available_agents, refresh_agents
def test_refresh_agents_function():
"""Test that refresh_agents clears the cache and rediscovers agents."""
# First call to get_available_agents should populate the cache... | 0 | assert | numeric_literal | tests/test_agent_refresh.py | test_refresh_agents_function | 23 | null | |
mpfaffenberger/code_puppy | from unittest.mock import MagicMock, patch
from code_puppy.agents.agent_creator_agent import AgentCreatorAgent
class TestAgentCreatorAgent:
def test_create_agent_json_success(self, tmp_path):
agent = AgentCreatorAgent()
config = {
"name": "test-agent",
"description": "Test... | True | assert | bool_literal | tests/test_agent_creator_full_coverage.py | test_create_agent_json_success | TestAgentCreatorAgent | 194 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
import time
import pytest
from .accounts import AccountManager
from .config import ANTIGRAVITY_OAUTH_CONFIG
from .constants import ANTIGRAVITY_MODELS, ANTIGRAVITY_SCOPES
from .oauth import (
_compute_code_challenge,
_decode_state,
_encode_state,
_generate_code_verif... | 1 | assert | numeric_literal | code_puppy/plugins/antigravity_oauth/test_plugin.py | test_migrate_v1_to_v2 | TestStorageMigration | 184 | null |
mpfaffenberger/code_puppy | from datetime import datetime, timedelta
from unittest.mock import MagicMock, Mock, patch
from rich.console import Console
from rich.table import Table
from code_puppy.mcp_.dashboard import MCPDashboard
from code_puppy.mcp_.status_tracker import ServerState
class TestRenderServerRow:
def test_render_server_row_... | row[2] | assert | complex_expr | tests/mcp/test_dashboard.py | test_render_server_row_with_all_data | TestRenderServerRow | 146 | null |
mpfaffenberger/code_puppy | from types import SimpleNamespace
from unittest.mock import MagicMock, patch
from code_puppy.command_line.command_handler import handle_command
from code_puppy.command_line.command_registry import get_command
def setup_messaging_mocks():
"""Set up mocks for all the messaging functions and return them in a diction... | "" | assert | string_literal | tests/test_command_handler.py | test_m_command_case_sensitive_baseline | 1,133 | null | |
mpfaffenberger/code_puppy | import pytest
from code_puppy.command_line.command_registry import (
CommandInfo,
clear_registry,
get_all_commands,
get_command,
get_unique_commands,
register_command,
)
class TestCommandInfo:
def test_command_info_minimal_parameters(self):
"""Test creating CommandInfo with minima... | [] | assert | collection | tests/test_command_registry.py | test_command_info_minimal_parameters | TestCommandInfo | 55 | null |
mpfaffenberger/code_puppy | import asyncio
from unittest.mock import patch
import pytest
from code_puppy.callbacks import (
clear_callbacks,
count_callbacks,
get_callbacks,
on_custom_command,
on_edit_file,
on_load_model_config,
on_post_tool_call,
on_pre_tool_call,
on_startup,
on_stream_event,
register... | 1 | assert | numeric_literal | tests/test_callbacks_extended.py | test_register_callback | TestCallbacksExtended | 40 | null |
mpfaffenberger/code_puppy | import asyncio
import queue
from unittest.mock import patch
import pytest
from code_puppy.messaging.bus import (
MessageBus,
emit,
emit_debug,
emit_error,
emit_info,
emit_shell_line,
emit_success,
emit_warning,
get_message_bus,
get_session_context,
reset_message_bus,
se... | b2 | assert | variable | tests/messaging/test_bus.py | test_global_bus_singleton | 402 | null | |
mpfaffenberger/code_puppy | from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
from unittest.mock import MagicMock, patch
import pytest
_REVIEWER_AGENTS = [
("code_puppy.agents.agent_c_reviewer", "CReviewerAgent"),
("code_puppy.agents.agent_code_reviewer", "CodeQualityReviewerAgent"),
("code_puppy.... | 1 | assert | numeric_literal | tests/test_coverage_agents_gaps.py | test_update_frame_when_spinning | TestSpinnerBaseGaps | 259 | null |
mpfaffenberger/code_puppy | import os
import pytest
from rich.table import Table
from code_puppy.command_line.utils import list_directory, make_directory_table
class TestListDirectory:
def test_list_directory_empty_directory(self, tmp_path):
"""Test listing an empty directory."""
dirs, files = list_directory(str(tmp_path))... | [] | assert | collection | tests/test_command_line_utils.py | test_list_directory_empty_directory | TestListDirectory | 35 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from code_puppy.summarization_agent import (
_ensure_thread_pool,
_run_agent_async,
get_summarization_agent,
reload_summarization_agent,
run_sum... | str | assert | variable | tests/test_summarization_agent.py | test_reload_summarization_agent_basic | TestSummarizationAgent | 123 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
import time
import pytest
from .accounts import AccountManager
from .config import ANTIGRAVITY_OAUTH_CONFIG
from .constants import ANTIGRAVITY_MODELS, ANTIGRAVITY_SCOPES
from .oauth import (
_compute_code_challenge,
_decode_state,
_encode_state,
_generate_code_verif... | 0 | assert | numeric_literal | code_puppy/plugins/antigravity_oauth/test_plugin.py | test_empty_manager | TestAccountManager | 215 | null |
mpfaffenberger/code_puppy | import json
import os
import tempfile
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from code_puppy.command_line.agent_menu import (
PAGE_SIZE,
_apply_pinned_model,
_build_model_picker_choices,
_get_agent_entries,
_get_pinned_model,
_normalize_model_choice,
_reload_ag... | "" | assert | string_literal | tests/command_line/test_agent_menu_coverage.py | test_empty_string | TestSanitizeDisplayText | 47 | null |
mpfaffenberger/code_puppy | from types import SimpleNamespace
from unittest.mock import MagicMock, patch
from code_puppy.command_line.command_handler import handle_command
from code_puppy.command_line.command_registry import get_command
def setup_messaging_mocks():
"""Set up mocks for all the messaging functions and return them in a diction... | None | assert | none_literal | tests/test_command_handler.py | test_agent_command_alias_a_registered | 1,362 | null | |
mpfaffenberger/code_puppy | import pytest
from code_puppy.command_line.command_registry import (
CommandInfo,
clear_registry,
get_all_commands,
get_command,
get_unique_commands,
register_command,
)
class TestCommandInfo:
def test_command_info_minimal_parameters(self):
"""Test creating CommandInfo with minima... | None | assert | none_literal | tests/test_command_registry.py | test_command_info_minimal_parameters | TestCommandInfo | 57 | null |
mpfaffenberger/code_puppy | import base64
import hashlib
import json
import time
from unittest.mock import Mock, patch
import pytest
import requests
from code_puppy.plugins.chatgpt_oauth.utils import (
OAuthContext,
_compute_code_challenge,
_generate_code_verifier,
_urlsafe_b64encode,
get_valid_access_token,
load_stored_... | 0o600 | assert | complex_expr | tests/plugins/test_chatgpt_oauth_core.py | test_save_tokens_file_permissions | TestTokenStorage | 275 | null |
mpfaffenberger/code_puppy | from io import StringIO
from unittest.mock import MagicMock, patch
import pytest
from rich.markdown import Markdown
from rich.table import Table
from rich.text import Text
from code_puppy.messaging.message_queue import MessageQueue, MessageType
from code_puppy.messaging.queue_console import QueueConsole, get_queue_co... | "" | assert | string_literal | tests/messaging/test_queue_console.py | test_input_empty | 242 | null | |
mpfaffenberger/code_puppy | import configparser
import os
from pathlib import Path
from unittest.mock import patch
import pytest
from code_puppy import callbacks, session_storage
from code_puppy import config as cp_config
def mock_config_paths(monkeypatch, tmp_path):
"""Mock XDG paths for isolated testing."""
mock_config_dir = str(tmp_... | 2 | assert | numeric_literal | tests/test_config_and_storage_edge_cases.py | test_save_session_creates_pickle_and_metadata | TestSessionSaveAndLoad | 490 | null |
mpfaffenberger/code_puppy | import asyncio
import os
from contextlib import ExitStack
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
def _mock_renderer():
r = MagicMock()
r.console = MagicMock()
r.console.file = MagicMock()
r.console.file.flush = MagicMock()
r.start = MagicMock()
r.stop = MagicMock()... | 0 | assert | numeric_literal | tests/test_cli_runner_full_coverage.py | test_keyboard_interrupt_stderr_output | TestMainEntryAdditional | 1,845 | null |
mpfaffenberger/code_puppy | from __future__ import annotations
import time
import pytest
from .accounts import AccountManager
from .config import ANTIGRAVITY_OAUTH_CONFIG
from .constants import ANTIGRAVITY_MODELS, ANTIGRAVITY_SCOPES
from .oauth import (
_compute_code_challenge,
_decode_state,
_encode_state,
_generate_code_verif... | None | assert | none_literal | code_puppy/plugins/antigravity_oauth/test_plugin.py | test_prepare_oauth_context | TestPKCE | 62 | null |
mpfaffenberger/code_puppy | import json
import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from code_puppy.agents.base_agent import BaseAgent
from code_puppy.agents.json_agent import JSONAgent, discover_json_agents
from code_puppy.config import get_user_agents_directory
class TestJSONAgentDiscovery... | 2 | assert | numeric_literal | tests/test_json_agents.py | test_discover_json_agents | TestJSONAgentDiscovery | 232 | null |
graphql-python/gql | import asyncio
import json
from base64 import b64decode
from typing import List
from urllib import parse
import pytest
from gql import Client, gql
from .conftest import MS, WebSocketServerHelper
pytestmark = pytest.mark.websockets
SEND_MESSAGE_DELAY = 20 * MS
NB_MESSAGES = 10
DUMMY_API_KEY = "da2-thisisadummyapik... | "val1" | assert | string_literal | tests/test_appsync_websockets.py | test_appsync_subscription_variable_values_and_operation_name | 714 | null | |
graphql-python/gql | from enum import Enum
from typing import Optional
import pytest
from graphql import (
GraphQLArgument,
GraphQLEnumType,
GraphQLField,
GraphQLList,
GraphQLNamedType,
GraphQLNonNull,
GraphQLObjectType,
GraphQLSchema,
)
from gql import Client, gql
from gql.utilities import update_schema_e... | "RED" | assert | string_literal | tests/custom_scalars/test_enum_colors.py | test_serialize_enum | 123 | null | |
graphql-python/gql | import json
from typing import Mapping
import pytest
from graphql import print_ast
from gql import gql
from gql.transport.exceptions import TransportConnectionFailed
pytestmark = pytest.mark.websockets
query1_str = """
query getContinents {
continents {
code
name
}
}
"""
query1_... | "r1" | assert | string_literal | tests/test_websockets_adapter.py | test_websockets_adapter_edge_cases | 82 | null | |
graphql-python/gql | import asyncio
import json
from base64 import b64decode
from typing import List
from urllib import parse
import pytest
from gql import Client, gql
from .conftest import MS, WebSocketServerHelper
pytestmark = pytest.mark.websockets
SEND_MESSAGE_DELAY = 20 * MS
NB_MESSAGES = 10
DUMMY_API_KEY = "da2-thisisadummyapik... | "appsync" | assert | string_literal | tests/test_appsync_websockets.py | verify_headers | 81 | null | |
graphql-python/gql | from typing import Mapping
import pytest
from gql import Client, GraphQLRequest, gql
from gql.transport.exceptions import (
TransportClosed,
TransportProtocolError,
TransportQueryError,
TransportServerError,
)
pytestmark = pytest.mark.requests
query1_str = """
query getContinents {
contine... | "Africa" | assert | string_literal | tests/test_requests_batch.py | test_requests_sync_batch_auto_execute_future | 650 | null | |
graphql-python/gql | import pytest
from graphql import GraphQLError
from gql import Client, gql
from tests.starwars.schema import StarWarsSchema
def client():
return Client(schema=StarWarsSchema)
def test_hero_name_query(client):
query = gql(
"""
query HeroNameQuery {
hero {
name
}... | expected | assert | variable | tests/starwars/test_query.py | test_hero_name_query | 25 | null | |
graphql-python/gql | import os
import warnings
from typing import Any, Dict, Mapping
import pytest
from gql import Client, FileVar, gql
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
TransportQueryError,
TransportServerError,
)
... | None | assert | none_literal | tests/test_requests.py | test_code | 1,087 | null | |
graphql-python/gql | import asyncio
import logging
from typing import Dict
import pytest
from gql import Client, gql
from gql.transport.exceptions import TransportError, TransportQueryError
from .conftest import MS
pytestmark = pytest.mark.websockets
logging.basicConfig(level=logging.INFO)
skip_reason = (
"backend does not suppor... | "AF" | assert | string_literal | tests/test_websocket_online.py | test_websocket_simple_query | 59 | null | |
graphql-python/gql | from typing import Mapping
import pytest
from gql import Client, GraphQLRequest
from gql.transport.exceptions import (
TransportClosed,
TransportProtocolError,
TransportQueryError,
)
pytestmark = pytest.mark.httpx
query1_str = """
query getContinents {
continents {
code
name
... | "val1" | assert | string_literal | tests/test_httpx_batch.py | test_httpx_async_batch_query_with_extensions | 375 | null | |
graphql-python/gql | import asyncio
import json
import sys
import warnings
from typing import List
import pytest
from graphql import ExecutionResult
from parse import search
from gql import Client, gql
from gql.client import AsyncClientSession
from gql.transport.exceptions import TransportConnectionFailed, TransportServerError
from .con... | 0 | assert | numeric_literal | tests/test_websocket_subscription.py | test_websocket_subscription_task_cancel | 245 | null | |
graphql-python/gql | import io
import json
from typing import Any, Dict, Mapping
import pytest
from gql import Client, FileVar, gql
from gql.cli import get_parser, main
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
TransportQueryEr... | "val1" | assert | string_literal | tests/test_httpx_async.py | test_httpx_query_with_extensions | 1,107 | null | |
graphql-python/gql | import asyncio
from typing import List
import pytest
from gql import Client, gql
from gql.transport.exceptions import (
TransportConnectionFailed,
TransportProtocolError,
TransportQueryError,
)
from .conftest import WebSocketServerHelper
pytestmark = [pytest.mark.aiohttp, pytest.mark.websockets]
invali... | asyncio.TimeoutError) | pytest.raises | complex_expr | tests/test_aiohttp_websocket_graphqlws_exceptions.py | test_aiohttp_websocket_graphqlws_server_does_not_send_ack | 121 | null | |
graphql-python/gql | import asyncio
import json
import sys
import warnings
from typing import List
import pytest
from graphql import ExecutionResult
from parse import search
from gql import Client, gql
from gql.client import AsyncClientSession
from gql.transport.exceptions import TransportConnectionFailed, TransportServerError
from .con... | 5 | assert | numeric_literal | tests/test_aiohttp_websocket_subscription.py | test_aiohttp_websocket_subscription_break | 268 | null | |
graphql-python/gql | import asyncio
import json
from base64 import b64decode
from typing import List
from urllib import parse
import pytest
from gql import Client, gql
from .conftest import MS, WebSocketServerHelper
pytestmark = pytest.mark.websockets
SEND_MESSAGE_DELAY = 20 * MS
NB_MESSAGES = 10
DUMMY_API_KEY = "da2-thisisadummyapik... | received_messages | assert | variable | tests/test_appsync_websockets.py | default_transport_test | 402 | null | |
graphql-python/gql | import asyncio
from typing import Mapping
import pytest
from gql import Client, GraphQLRequest, gql
from gql.transport.exceptions import (
TransportClosed,
TransportProtocolError,
TransportQueryError,
TransportServerError,
)
pytestmark = pytest.mark.aiohttp
query1_str = """
query getContinents {... | "val1" | assert | string_literal | tests/test_aiohttp_batch.py | test_aiohttp_batch_query_with_extensions | 491 | null | |
graphql-python/gql | from typing import Mapping
import pytest
from gql import Client, GraphQLRequest
from gql.transport.exceptions import (
TransportClosed,
TransportProtocolError,
TransportQueryError,
)
pytestmark = pytest.mark.httpx
query1_str = """
query getContinents {
continents {
code
name
... | "Africa" | assert | string_literal | tests/test_httpx_batch.py | test_httpx_batch_online_async_manual | 407 | null | |
graphql-python/gql | import asyncio
import json
import types
from typing import List
import pytest
from gql import Client, gql
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportConnectionFailed,
TransportProtocolError,
TransportQueryError,
)
from .conftest import MS, WebSocketServerHelper
pytest... | captured_err | assert | variable | tests/test_websocket_exceptions.py | test_websocket_using_cli_invalid_query | 413 | null | |
graphql-python/gql | from graphql.type import (
GraphQLArgument,
GraphQLField,
GraphQLInt,
GraphQLList,
GraphQLNonNull,
GraphQLObjectType,
GraphQLSchema,
GraphQLString,
)
from gql import Client, gql
static_result = {
"edges": [
{
"node": {
"from": {"address": "0x45b9... | {"test": static_result} | assert | collection | tests/custom_scalars/test_parse_results.py | test_parse_results_null_mapping | 97 | null | |
graphql-python/gql | import io
import json
from typing import Any, Dict, Mapping
import pytest
from gql import Client, FileVar, gql
from gql.cli import get_parser, main
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
TransportQueryEr... | output | assert | variable | tests/test_httpx_async.py | test_httpx_subscribe_not_supported_cli | 1,508 | null | |
graphql-python/gql | from typing import Mapping
import pytest
from gql import Client, GraphQLRequest, gql
from gql.transport.exceptions import (
TransportClosed,
TransportProtocolError,
TransportQueryError,
TransportServerError,
)
pytestmark = pytest.mark.requests
query1_str = """
query getContinents {
contine... | "Europe" | assert | string_literal | tests/test_requests_batch.py | test_requests_sync_batch_auto_execute_future | 649 | null | |
graphql-python/gql | import asyncio
import json
import sys
from typing import Any, Dict, Mapping
import pytest
from gql import Client, gql
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportConnectionFailed,
TransportQueryError,
TransportServerError,
)
from .conftest import MS, WebSocketServerHelp... | {} | assert | collection | tests/test_websocket_query.py | test_websocket_starting_client_in_context_manager | 61 | null | |
graphql-python/gql | from enum import Enum
from typing import Optional
import pytest
from graphql import (
GraphQLArgument,
GraphQLEnumType,
GraphQLField,
GraphQLList,
GraphQLNamedType,
GraphQLNonNull,
GraphQLObjectType,
GraphQLSchema,
)
from gql import Client, gql
from gql.utilities import update_schema_e... | RED | assert | variable | tests/custom_scalars/test_enum_colors.py | test_parse_value_enum | 114 | null | |
graphql-python/gql | from enum import Enum
from typing import Optional
import pytest
from graphql import (
GraphQLArgument,
GraphQLEnumType,
GraphQLField,
GraphQLList,
GraphQLNamedType,
GraphQLNonNull,
GraphQLObjectType,
GraphQLSchema,
)
from gql import Client, gql
from gql.utilities import update_schema_e... | ALL_COLORS | assert | variable | tests/custom_scalars/test_enum_colors.py | test_get_all_colors | 138 | null | |
graphql-python/gql | import os
import pytest
from gql import Client, gql
URL = "http://127.0.0.1:8000/graphql"
pytestmark = pytest.mark.requests
def use_cassette(name):
import vcr
query_vcr = vcr.VCR(
cassette_library_dir=os.path.join(
os.path.dirname(__file__), "fixtures", "vcr_cassettes"
),
... | expected | assert | variable | tests/test_transport_batch.py | test_hero_name_query | 91 | null | |
graphql-python/gql | import asyncio
import sys
from typing import Dict
import pytest
from gql import Client, gql
from gql.transport.exceptions import TransportQueryError
async def query_task2():
result = await session.execute(query2)
assert isinstance(result, Dict)
print(result)
... | "Africa" | assert | string_literal | tests/test_httpx_online.py | query_task2 | 139 | null | |
graphql-python/gql | import asyncio
from math import isfinite
from typing import Any, Dict, NamedTuple, Optional
import pytest
from graphql import ExecutionResult, graphql_sync
from graphql.error import GraphQLError
from graphql.language import ValueNode
from graphql.pyutils import inspect
from graphql.type import (
GraphQLArgument,
... | result | assert | variable | tests/custom_scalars/test_money.py | test_custom_scalar_subscribe_in_input_variable_values_serialized | 408 | null | |
graphql-python/gql | import asyncio
import json
import sys
import warnings
from typing import List
import pytest
from graphql import ExecutionResult
from parse import search
from gql import Client, gql
from gql.client import AsyncClientSession
from gql.transport.exceptions import TransportConnectionFailed, TransportServerError
from .con... | 4 | assert | numeric_literal | tests/test_aiohttp_websocket_subscription.py | test_aiohttp_websocket_subscription_sync_graceful_shutdown | 689 | null | |
graphql-python/gql | import asyncio
import json
import sys
import warnings
from typing import List
import pytest
from parse import search
from gql import Client, gql
from gql.client import AsyncClientSession
from gql.transport.exceptions import TransportConnectionFailed, TransportServerError
from .conftest import MS, WebSocketServerHelp... | 4 | assert | numeric_literal | tests/test_graphqlws_subscription.py | test_graphqlws_subscription_sync_graceful_shutdown | 776 | null | |
graphql-python/gql | import asyncio
import json
import sys
import warnings
from typing import List
import pytest
from graphql import ExecutionResult
from parse import search
from gql import Client, gql
from gql.client import AsyncClientSession
from gql.transport.exceptions import TransportConnectionFailed, TransportServerError
from .con... | True | assert | bool_literal | tests/test_aiohttp_websocket_subscription.py | test_aiohttp_websocket_subscription_task_cancel | 319 | null | |
graphql-python/gql | import pytest
mock_transport_host = "appsyncapp.awsgateway.com.example.org"
mock_transport_url = f"https://{mock_transport_host}/graphql"
@pytest.mark.botocore
def test_appsync_init_with_minimal_args(fake_session_factory):
from gql.transport.appsync_auth import AppSyncIAMAuthentication
from gql.transport.apps... | {} | assert | collection | tests/test_appsync_auth.py | test_appsync_init_with_minimal_args | 20 | null | |
graphql-python/gql | import os
import pytest
from gql import Client, gql
URL = "http://127.0.0.1:8000/graphql"
pytestmark = pytest.mark.requests
def use_cassette(name):
import vcr
query_vcr = vcr.VCR(
cassette_library_dir=os.path.join(
os.path.dirname(__file__), "fixtures", "vcr_cassettes"
),
... | expected | assert | variable | tests/test_transport.py | test_hero_name_query | 89 | null | |
graphql-python/gql | import asyncio
import sys
from typing import Dict
import pytest
from gql import Client, gql
from gql.transport.exceptions import TransportQueryError
async def query_task2():
result = await session.execute(query2)
assert isinstance(result, Dict)
print(result)
... | "Africa" | assert | string_literal | tests/test_aiohttp_online.py | query_task2 | 139 | null | |
graphql-python/gql | import asyncio
import json
import sys
from typing import Any, Dict, Mapping
import pytest
from gql import Client, gql
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportConnectionFailed,
TransportQueryError,
TransportServerError,
)
from .conftest import MS, WebSocketServerHelp... | "AF" | assert | string_literal | tests/test_websocket_query.py | test_websocket_starting_client_in_context_manager | 81 | null | |
graphql-python/gql | import io
import json
import os
import warnings
from typing import Mapping
import pytest
from gql import Client, FileVar, gql
from gql.cli import get_parser, main
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
T... | 1 | assert | numeric_literal | tests/test_aiohttp.py | test_aiohttp_using_cli_invalid_param | 1,303 | null | |
graphql-python/gql | import asyncio
from math import isfinite
from typing import Any, Dict, NamedTuple, Optional
import pytest
from graphql.error import GraphQLError
from graphql.language import ValueNode
from graphql.pyutils import inspect
from graphql.type import (
GraphQLArgument,
GraphQLField,
GraphQLFloat,
GraphQLList... | money_value_1 | assert | variable | tests/test_graphql_request.py | test_graphql_request_init_with_graphql_request | 236 | null | |
graphql-python/gql | import asyncio
from typing import Mapping
import pytest
from gql import Client, GraphQLRequest, gql
from gql.transport.exceptions import (
TransportClosed,
TransportProtocolError,
TransportQueryError,
TransportServerError,
)
pytestmark = pytest.mark.aiohttp
query1_str = """
query getContinents {... | "test1234" | assert | string_literal | tests/test_aiohttp_batch.py | test_aiohttp_batch_query | 89 | null | |
graphql-python/gql | import pytest
from gql import Client, gql
@pytest.mark.aiohttp
@pytest.mark.online
@pytest.mark.parametrize("fetch_schema_from_transport", [True, False])
def test_sync_client_async_transport(fetch_schema_from_transport):
from gql.transport.aiohttp import AIOHTTPTransport
# Create https url
url = "https:... | "AF" | assert | string_literal | tests/test_http_async_sync.py | test_sync_client_async_transport | 111 | null | |
graphql-python/gql | import io
import json
from typing import Any, Dict, Mapping
import pytest
from gql import Client, FileVar, gql
from gql.cli import get_parser, main
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
TransportQueryEr... | "3600" | assert | string_literal | tests/test_httpx_async.py | test_httpx_error_code_429 | 234 | null | |
graphql-python/gql | import asyncio
import json
import graphql
import pytest
from gql import Client, gql
from .conftest import MS, WebSocketServerHelper
from .starwars.schema import StarWarsIntrospection, StarWarsSchema, StarWarsTypeDef
starwars_expected_one = {
"stars": 3,
"commentary": "Was expecting more stuff",
"episode... | AssertionError) | pytest.raises | variable | tests/test_async_client_validation.py | test_async_client_validation_different_schemas_parameters_forbidden | 172 | null | |
graphql-python/gql | import asyncio
import json
from unittest.mock import AsyncMock, patch
import pytest
from gql import Client, gql
from gql.graphql_request import GraphQLRequest
from gql.transport.exceptions import (
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
TransportServerError,
)
pytestmark ... | None | assert | none_literal | tests/test_aiohttp_multipart.py | test_aiohttp_multipart_graphql_errors | 288 | null | |
graphql-python/gql | from typing import Any, Dict, Optional
import pytest
from graphql import (
GraphQLArgument,
GraphQLError,
GraphQLField,
GraphQLFloat,
GraphQLInt,
GraphQLNonNull,
GraphQLObjectType,
GraphQLScalarType,
GraphQLSchema,
)
from graphql.language import ValueNode
from graphql.utilities impo... | "Barbara" | assert | string_literal | tests/custom_scalars/test_json.py | test_json_value_input_in_ast_with_variables | 184 | null | |
graphql-python/gql | import asyncio
import logging
from typing import Dict
import pytest
from gql import Client, gql
from gql.transport.exceptions import TransportError, TransportQueryError
from .conftest import MS
pytestmark = pytest.mark.websockets
logging.basicConfig(level=logging.INFO)
skip_reason = (
"backend does not suppor... | None | assert | none_literal | tests/test_websocket_online.py | test_websocket_sending_invalid_data | 123 | null | |
graphql-python/gql | import asyncio
import json
import sys
import warnings
from typing import List
import pytest
from parse import search
from gql import Client, gql
from gql.client import AsyncClientSession
from gql.transport.exceptions import TransportConnectionFailed, TransportServerError
from .conftest import MS, WebSocketServerHelp... | count | assert | variable | tests/test_aiohttp_websocket_graphqlws_subscription.py | test_aiohttp_websocket_graphqlws_subscription | 246 | null | |
graphql-python/gql | from enum import Enum
from typing import Optional
import pytest
from graphql import (
GraphQLArgument,
GraphQLEnumType,
GraphQLField,
GraphQLList,
GraphQLNamedType,
GraphQLNonNull,
GraphQLObjectType,
GraphQLSchema,
)
from gql import Client, gql
from gql.utilities import update_schema_e... | 0 | assert | numeric_literal | tests/custom_scalars/test_enum_colors.py | test_update_schema_enum | 268 | null | |
graphql-python/gql | import os
import warnings
from typing import Any, Dict, Mapping
import pytest
from gql import Client, FileVar, gql
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
TransportQueryError,
TransportServerError,
)
... | request.headers | assert | complex_expr | tests/test_requests.py | handler | 208 | null | |
graphql-python/gql | import logging
import pytest
from gql import __version__
from gql.cli import (
get_execute_args,
get_introspection_args,
get_parser,
get_transport,
get_transport_args,
main,
)
def parser():
return get_parser()
def test_cli_parse_headers_invalid_header(parser):
args = parser.parse_ar... | ValueError) | pytest.raises | variable | tests/test_cli.py | test_cli_parse_headers_invalid_header | 128 | null | |
graphql-python/gql | from datetime import datetime, timedelta
from typing import Any, Dict, Optional
from graphql.error import GraphQLError
from graphql.language import ValueNode
from graphql.pyutils import inspect
from graphql.type import (
GraphQLArgument,
GraphQLField,
GraphQLInputField,
GraphQLInputObjectType,
Grap... | in_five_days | assert | variable | tests/custom_scalars/test_datetime.py | test_latest | 182 | null | |
graphql-python/gql | import io
import json
from typing import Any, Dict, Mapping
import pytest
from gql import Client, FileVar, gql
from gql.cli import get_parser, main
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
TransportQueryEr... | "test1234" | assert | string_literal | tests/test_httpx_async.py | test_httpx_query | 86 | null | |
graphql-python/gql | import logging
import pytest
from gql import __version__
from gql.cli import (
get_execute_args,
get_introspection_args,
get_parser,
get_transport,
get_transport_args,
main,
)
def parser():
return get_parser()
def test_cli_parse_operation_name(parser):
args = parser.parse_args(["htt... | {"operation_name": "myop"} | assert | collection | tests/test_cli.py | test_cli_parse_operation_name | 138 | null | |
graphql-python/gql | import io
import json
import os
import warnings
from typing import Mapping
import pytest
from gql import Client, FileVar, gql
from gql.cli import get_parser, main
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
T... | True | assert | bool_literal | tests/test_aiohttp.py | test_aiohttp_query_https_self_cert_default | 1,488 | null | |
graphql-python/gql | import logging
import pytest
from gql import __version__
from gql.cli import (
get_execute_args,
get_introspection_args,
get_parser,
get_transport,
get_transport_args,
main,
)
def parser():
return get_parser()
def test_cli_parser(parser):
# Simple call with https server
# gql-cl... | None | assert | none_literal | tests/test_cli.py | test_cli_parser | 28 | null | |
graphql-python/gql | from typing import Mapping
import pytest
from gql import Client, GraphQLRequest
from gql.transport.exceptions import (
TransportClosed,
TransportProtocolError,
TransportQueryError,
)
pytestmark = pytest.mark.httpx
query1_str = """
query getContinents {
continents {
code
name
... | "Europe" | assert | string_literal | tests/test_httpx_batch.py | test_httpx_batch_online_async_manual | 406 | null | |
graphql-python/gql | from typing import Mapping
import pytest
from gql import Client, GraphQLRequest
from gql.transport.exceptions import (
TransportClosed,
TransportProtocolError,
TransportQueryError,
)
pytestmark = pytest.mark.httpx
query1_str = """
query getContinents {
continents {
code
name
... | "AF" | assert | string_literal | tests/test_httpx_batch.py | test_httpx_async_batch_query | 68 | null | |
graphql-python/gql | import asyncio
import json
import sys
import warnings
from typing import List
import pytest
from graphql import ExecutionResult
from parse import search
from gql import Client, gql
from gql.client import AsyncClientSession
from gql.transport.exceptions import TransportConnectionFailed, TransportServerError
from .con... | True | assert | bool_literal | tests/test_websocket_subscription.py | test_websocket_subscription_task_cancel | 246 | null | |
graphql-python/gql | import asyncio
from typing import Mapping
import pytest
from gql import Client, GraphQLRequest, gql
from gql.transport.exceptions import (
TransportClosed,
TransportProtocolError,
TransportQueryError,
TransportServerError,
)
pytestmark = pytest.mark.aiohttp
query1_str = """
query getContinents {... | TransportClosed) | pytest.raises | variable | tests/test_aiohttp_batch.py | test_aiohttp_batch_cannot_execute_if_not_connected | 403 | null | |
graphql-python/gql | import pytest
from graphql import GraphQLError
from gql import Client, gql
from tests.starwars.schema import StarWarsSchema
def client():
return Client(schema=StarWarsSchema)
def test_parse_error(client):
with pytest.raises(Exception) as exc_info:
gql(
"""
qeury
""... | str(error) | assert | func_call | tests/starwars/test_query.py | test_parse_error | 305 | null | |
graphql-python/gql | import json
from typing import Mapping
import pytest
from graphql import print_ast
from gql import gql
from gql.transport.exceptions import TransportConnectionFailed
pytestmark = pytest.mark.websockets
query1_str = """
query getContinents {
continents {
code
name
}
}
"""
query1_... | {} | assert | collection | tests/test_websockets_adapter.py | test_websockets_adapter_edge_cases | 84 | null | |
graphql-python/gql | import asyncio
import json
from base64 import b64decode
from typing import List
from urllib import parse
import pytest
from gql import Client, gql
from .conftest import MS, WebSocketServerHelper
pytestmark = pytest.mark.websockets
SEND_MESSAGE_DELAY = 20 * MS
NB_MESSAGES = 10
DUMMY_API_KEY = "da2-thisisadummyapik... | "amz-1.0" | assert | string_literal | tests/test_appsync_websockets.py | verify_headers | 59 | null | |
graphql-python/gql | from enum import Enum
from typing import Optional
import pytest
from graphql import (
GraphQLArgument,
GraphQLEnumType,
GraphQLField,
GraphQLList,
GraphQLNamedType,
GraphQLNonNull,
GraphQLObjectType,
GraphQLSchema,
)
from gql import Client, gql
from gql.utilities import update_schema_e... | list_of_list_of_list[0] | assert | complex_expr | tests/custom_scalars/test_enum_colors.py | test_list_of_list | 234 | null | |
graphql-python/gql | from enum import Enum
from typing import Optional
import pytest
from graphql import (
GraphQLArgument,
GraphQLEnumType,
GraphQLField,
GraphQLList,
GraphQLNamedType,
GraphQLNonNull,
GraphQLObjectType,
GraphQLSchema,
)
from gql import Client, gql
from gql.utilities import update_schema_e... | CYAN | assert | variable | tests/custom_scalars/test_enum_colors.py | test_opposite_color_literal | 154 | null | |
graphql-python/gql | import logging
import pytest
from gql import __version__
from gql.cli import (
get_execute_args,
get_introspection_args,
get_parser,
get_transport,
get_transport_args,
main,
)
def parser():
return get_parser()
@pytest.mark.script_launch_mode("subprocess")
def test_cli_ep_version(script_r... | "" | assert | string_literal | tests/test_cli.py | test_cli_ep_version | 396 | null | |
graphql-python/gql | import logging
import pytest
from gql import __version__
from gql.cli import (
get_execute_args,
get_introspection_args,
get_parser,
get_transport,
get_transport_args,
main,
)
def parser():
return get_parser()
@pytest.mark.websockets
@pytest.mark.parametrize(
"url",
["wss://XXXXX... | "test-jwt" | assert | string_literal | tests/test_cli.py | test_cli_get_transport_appsync_websockets_jwt | 321 | null | |
graphql-python/gql | import asyncio
import json
from unittest.mock import AsyncMock, patch
import pytest
from gql import Client, gql
from gql.graphql_request import GraphQLRequest
from gql.transport.exceptions import (
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
TransportServerError,
)
pytestmark ... | 1 | assert | numeric_literal | tests/test_aiohttp_multipart.py | test_aiohttp_multipart_chunked_boundary_split | 453 | null | |
graphql-python/gql | import io
import json
import os
import warnings
from typing import Mapping
import pytest
from gql import Client, FileVar, gql
from gql.cli import get_parser, main
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
T... | 0 | assert | numeric_literal | tests/test_aiohttp.py | test_aiohttp_using_cli | 1,229 | null | |
graphql-python/gql | import os
from typing import Any, Dict, Mapping
import pytest
from gql import Client, FileVar, gql
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
TransportQueryError,
TransportServerError,
)
from .conftest ... | None | assert | none_literal | tests/test_httpx.py | test_code | 979 | null | |
graphql-python/gql | import asyncio
from typing import List
import pytest
from gql import Client, gql
from gql.transport.exceptions import (
TransportConnectionFailed,
TransportProtocolError,
TransportQueryError,
)
from .conftest import WebSocketServerHelper
pytestmark = pytest.mark.websockets
invalid_query_str = """
q... | asyncio.TimeoutError) | pytest.raises | complex_expr | tests/test_graphqlws_exceptions.py | test_graphqlws_server_does_not_send_ack | 115 | null | |
graphql-python/gql | import pytest
mock_transport_host = "appsyncapp.awsgateway.com.example.org"
mock_transport_url = f"https://{mock_transport_host}/graphql"
@pytest.mark.botocore
def test_appsync_init_with_no_credentials(caplog, fake_session_factory):
import botocore.exceptions
from gql.transport.appsync_websockets import AppS... | None | assert | none_literal | tests/test_appsync_auth.py | test_appsync_init_with_no_credentials | 34 | null | |
graphql-python/gql | import asyncio
import json
import sys
from typing import Any, Dict, Mapping
import pytest
from gql import Client, gql
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportConnectionFailed,
TransportQueryError,
TransportServerError,
)
from .conftest import MS, WebSocketServerHelp... | True | assert | bool_literal | tests/test_aiohttp_websocket_query.py | test_aiohttp_websocket_using_ssl_connection_self_cert_fail | 177 | null | |
graphql-python/gql | import os
from typing import Any, Dict, Mapping
import pytest
from gql import Client, FileVar, gql
from gql.transport.exceptions import (
TransportAlreadyConnected,
TransportClosed,
TransportConnectionFailed,
TransportProtocolError,
TransportQueryError,
TransportServerError,
)
from .conftest ... | "AF" | assert | string_literal | tests/test_httpx.py | test_code | 77 | null | |
graphql-python/gql | import os
from contextlib import suppress
from typing import Any
from unittest import mock
import pytest
from graphql import ExecutionResult, build_ast_schema, parse
from gql import Client, GraphQLRequest, gql
from gql.transport import Transport
from gql.transport.exceptions import TransportQueryError
def http_trans... | NotImplementedError) | pytest.raises | variable | tests/test_client.py | test_request_transport_not_implemented | 49 | null | |
graphql-python/gql | import logging
import pytest
from gql import __version__
from gql.cli import (
get_execute_args,
get_introspection_args,
get_parser,
get_transport,
get_transport_args,
main,
)
def parser():
return get_parser()
def test_cli_parse_headers(parser):
args = parser.parse_args(
[
... | {"headers": expected_headers} | assert | collection | tests/test_cli.py | test_cli_parse_headers | 119 | null | |
graphql-python/gql | import copy
import pytest
from gql import Client, gql
from .schema import StarWarsIntrospection, StarWarsSchema
def local_schema():
return Client(schema=StarWarsSchema)
def typedef_schema():
return Client(
schema="""
schema {
query: Query
}
interface Character {
appearsIn: [Episode]
friends:... | TypeError) | pytest.raises | variable | tests/starwars/test_validation.py | test_build_client_schema_invalid_introspection | 255 | null | |
graphql-python/gql | import asyncio
import json
import sys
import warnings
from typing import List
import pytest
from graphql import ExecutionResult
from parse import search
from gql import Client, gql
from gql.client import AsyncClientSession
from gql.transport.exceptions import TransportConnectionFailed, TransportServerError
from .con... | 0 | assert | numeric_literal | tests/test_aiohttp_websocket_subscription.py | test_aiohttp_websocket_subscription_task_cancel | 318 | null | |
graphql-python/gql | import asyncio
from math import isfinite
from typing import Any, Dict, NamedTuple, Optional
import pytest
from graphql.error import GraphQLError
from graphql.language import ValueNode
from graphql.pyutils import inspect
from graphql.type import (
GraphQLArgument,
GraphQLField,
GraphQLFloat,
GraphQLList... | money_value_2 | assert | variable | tests/test_graphql_request.py | test_graphql_request_init_with_graphql_request | 238 | null | |
graphql-python/gql | import os
from contextlib import suppress
from typing import Any
from unittest import mock
import pytest
from graphql import ExecutionResult, build_ast_schema, parse
from gql import Client, GraphQLRequest, gql
from gql.transport import Transport
from gql.transport.exceptions import TransportQueryError
def http_trans... | 1 | assert | numeric_literal | tests/test_client.py | test_http_transport_verify_error | 165 | null | |
graphql-python/gql | import asyncio
from math import isfinite
from typing import Any, Dict, NamedTuple, Optional
import pytest
from graphql.error import GraphQLError
from graphql.language import ValueNode
from graphql.pyutils import inspect
from graphql.type import (
GraphQLArgument,
GraphQLField,
GraphQLFloat,
GraphQLList... | request_2.document | assert | complex_expr | tests/test_graphql_request.py | test_graphql_request_init_with_graphql_request | 231 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.