repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
strawberry | tests/schema/test_camel_casing.py | .py | import strawberry
from strawberry.schema.config import StrawberryConfig
def test_camel_case_is_on_by_default():
@strawberry.type
class Query:
example_field: str = "Example"
schema = strawberry.Schema(query=Query)
query = """
{
__type(name: "Query") {
field... | 209 | 4,839 |
strawberry | tests/schema/test_config.py | .py | import pytest
from strawberry.schema.config import StrawberryConfig
from strawberry.types.info import Info
def test_config_post_init_auto_camel_case():
config = StrawberryConfig(auto_camel_case=True)
assert config.name_converter.auto_camel_case is True
def test_config_post_init_no_auto_camel_case():
c... | 40 | 1,024 |
strawberry | tests/schema/test_basic.py | .py | import textwrap
from dataclasses import InitVar, dataclass
from enum import Enum
import pytest
import strawberry
from strawberry import ID
from strawberry.scalars import Base64
from strawberry.schema_directive import Location
from strawberry.types.base import StrawberryList
def test_raises_exception_with_unsupporte... | 613 | 14,492 |
strawberry | tests/schema/test_duplicated_types.py | .py | import textwrap
from enum import Enum
from typing import Generic, TypeVar
import pytest
import strawberry
from strawberry.exceptions import DuplicatedTypeName
from strawberry.schema.config import StrawberryConfig
@pytest.mark.raises_strawberry_exception(
DuplicatedTypeName,
match=r"Type (.*) is defined mult... | 264 | 5,551 |
strawberry | tests/schema/test_print.py | .py | import pytest
import strawberry
from strawberry.utils import IS_GQL_32
def _get_snake_case_schema_str() -> str:
@strawberry.input
class Bar:
a: str
b: str
some_values: list[str] | None = None
@strawberry.input(one_of=True)
class Foo:
bar: strawberry.Maybe[Bar]
... | 153 | 3,232 |
strawberry | tests/schema/test_custom_scalar.py | .py | import base64
from typing import NewType
import strawberry
Base64Encoded = strawberry.scalar(
NewType("Base64Encoded", bytes),
serialize=base64.b64encode,
parse_value=base64.b64decode,
)
@strawberry.scalar(serialize=lambda x: 42, parse_value=lambda x: Always42())
class Always42:
pass
MyStr = straw... | 83 | 2,082 |
strawberry | tests/schema/test_directives.py | .py | import textwrap
from enum import Enum
from typing import Any, NoReturn
import pytest
import strawberry
from strawberry import Info
from strawberry.directive import DirectiveLocation, DirectiveValue
from strawberry.extensions import SchemaExtension
from strawberry.schema.config import StrawberryConfig
from strawberry.... | 705 | 19,326 |
strawberry | tests/schema/test_mutation.py | .py | import dataclasses
from textwrap import dedent
import strawberry
from strawberry.types.unset import UNSET
def test_mutation():
@strawberry.type
class Query:
hello: str = "Hello"
@strawberry.type
class Mutation:
@strawberry.mutation
def say(self) -> str:
return "He... | 259 | 6,475 |
strawberry | tests/schema/test_generics_nested.py | .py | import textwrap
from typing import Generic, TypeVar
import strawberry
from strawberry.scalars import JSON
def test_support_nested_generics():
T = TypeVar("T")
@strawberry.type
class User:
name: str
@strawberry.type
class Edge(Generic[T]):
node: T
@strawberry.type
class ... | 399 | 9,237 |
strawberry | tests/schema/test_info.py | .py | import dataclasses
import json
from typing import Annotated, Optional
import pytest
import strawberry
from strawberry.types.base import StrawberryOptional
from strawberry.types.nodes import FragmentSpread, InlineFragment, SelectedField
from strawberry.types.unset import UNSET
def test_info_has_the_correct_shape():
... | 381 | 9,964 |
strawberry | tests/schema/test_get_extensions.py | .py | import strawberry
from strawberry.directive import DirectiveLocation, DirectiveValue
from strawberry.extensions import SchemaExtension
from strawberry.extensions.directives import (
DirectivesExtension,
DirectivesExtensionSync,
)
@strawberry.type
class Query:
example: str
@strawberry.directive(locations... | 115 | 3,419 |
strawberry | tests/schema/test_permission.py | .py | import re
import textwrap
import typing
import pytest
import strawberry
from strawberry.exceptions import StrawberryGraphQLError
from strawberry.exceptions.permission_fail_silently_requires_optional import (
PermissionFailSilentlyRequiresOptionalError,
)
from strawberry.permission import BasePermission, Permissio... | 586 | 18,064 |
strawberry | tests/schema/test_subscription.py | .py | # ruff: noqa: F821
from __future__ import annotations
from collections import abc # noqa: F401
from collections.abc import AsyncGenerator, AsyncIterable, AsyncIterator # noqa: F401
from typing import (
Annotated,
Any,
)
import pytest
import strawberry
from strawberry.types.execution import PreExecutionErro... | 284 | 7,358 |
strawberry | tests/schema/test_union.py | .py | import textwrap
from dataclasses import dataclass
from textwrap import dedent
from typing import Annotated, Any, ClassVar, Generic, TypeVar, Union
import pytest
import strawberry
from strawberry.exceptions import InvalidUnionTypeError
from strawberry.types.lazy_type import lazy
def test_union_as_field():
@straw... | 1,443 | 29,278 |
strawberry | tests/schema/test_pydantic.py | .py | import pytest
import strawberry
pytestmark = pytest.mark.pydantic
def test_use_alias_as_gql_name():
from pydantic import BaseModel, Field
class UserModel(BaseModel):
age_: int = Field(..., alias="age_alias")
@strawberry.experimental.pydantic.type(
UserModel, all_fields=True, use_pydant... | 70 | 1,582 |
strawberry | tests/schema/test_name_converter.py | .py | import textwrap
from enum import Enum
from typing import Annotated, Generic, TypeVar
import strawberry
from strawberry.directive import StrawberryDirective
from strawberry.schema.config import StrawberryConfig
from strawberry.schema.name_converter import NameConverter
from strawberry.schema_directive import Location, ... | 227 | 5,438 |
strawberry | tests/schema/test_maybe_future_annotations.py | .py | from __future__ import annotations
from textwrap import dedent
import strawberry
from strawberry import Maybe
def test_maybe_annotation_from_strawberry():
global MyInput
try:
@strawberry.input
class MyInput:
my_value: strawberry.Maybe[str]
@strawberry.type
class... | 69 | 1,444 |
strawberry | tests/schema/test_one_of.py | .py | from typing import Any
import pytest
import strawberry
from strawberry.schema_directives import OneOf
@strawberry.input(one_of=True)
class ExampleInputTagged:
a: strawberry.Maybe[str | None]
b: strawberry.Maybe[int | None]
@strawberry.type
class ExampleResult:
a: str | None
b: int | None
@strawb... | 281 | 6,883 |
strawberry | tests/schema/test_exception_handlers.py | .py | import dataclasses
from collections.abc import AsyncGenerator
from typing import Annotated, Generic, TypeVar
import pytest
import strawberry
from strawberry.extensions.field_extension import FieldExtension
from strawberry.field_extensions import InputMutationExtension
from strawberry.permission import BasePermission
... | 1,853 | 53,689 |
strawberry | tests/schema/test_interface.py | .py | from dataclasses import dataclass
from typing import Any
import pytest
from pytest_mock import MockerFixture
import strawberry
from strawberry.types.base import StrawberryObjectDefinition
def test_query_interface():
@strawberry.interface
class Cheese:
name: str
@strawberry.type
class Swiss(... | 426 | 11,197 |
strawberry | tests/schema/test_schema_hooks.py | .py | import textwrap
import strawberry
from strawberry.types.base import StrawberryObjectDefinition
from strawberry.types.field import StrawberryField
def test_can_change_which_fields_are_exposed():
@strawberry.type
class User:
name: str
email: str = strawberry.field(metadata={"tags": ["internal"]... | 43 | 1,064 |
strawberry | tests/schema/test_extensions.py | .py | from enum import Enum, auto
from typing import Annotated, cast
from graphql import (
DirectiveLocation,
GraphQLEnumType,
GraphQLInputType,
GraphQLObjectType,
GraphQLSchema,
)
import strawberry
from strawberry.directive import DirectiveValue
from strawberry.scalars import JSON
from strawberry.schem... | 194 | 5,554 |
strawberry | tests/schema/test_private_field.py | .py | from dataclasses import dataclass
from typing import Generic, TypeVar
import pytest
import strawberry
from strawberry.annotation import StrawberryAnnotation
from strawberry.exceptions import PrivateStrawberryFieldError
from strawberry.types.field import StrawberryField
def test_private_field():
@strawberry.type... | 139 | 3,725 |
strawberry | tests/schema/test_scalars.py | .py | from datetime import date, datetime, timedelta, timezone
from decimal import Decimal
from textwrap import dedent
from typing import Any
from uuid import UUID
import pytest
import strawberry
from strawberry import scalar
from strawberry.exceptions import ScalarAlreadyRegisteredError
from strawberry.scalars import JSON... | 760 | 19,898 |
strawberry | tests/schema/test_fields.py | .py | import dataclasses
import textwrap
from operator import getitem
import strawberry
from strawberry.printer import print_schema
from strawberry.schema.config import StrawberryConfig
from strawberry.types.field import StrawberryField
def test_custom_field():
class CustomField(StrawberryField):
def get_resul... | 174 | 3,689 |
strawberry | tests/schema/test_arguments.py | .py | import textwrap
from textwrap import dedent
from typing import Annotated
import strawberry
from strawberry.types.unset import UNSET
def test_argument_descriptions():
@strawberry.type
class Query:
@strawberry.field
def hello( # type: ignore
name: Annotated[
str, st... | 238 | 5,951 |
strawberry | tests/schema/test_unresolved_fields.py | .py | import pytest
import strawberry
from strawberry.exceptions.unresolved_field_type import UnresolvedFieldTypeError
@pytest.mark.raises_strawberry_exception(
UnresolvedFieldTypeError,
match=(
"Could not resolve the type of 'user'. Check that "
"the class is accessible from the global module scop... | 37 | 941 |
strawberry | tests/schema/test_list.py | .py | import strawberry
def test_basic_list():
@strawberry.type
class Query:
@strawberry.field
def example(self) -> list[str]:
return ["Example"]
schema = strawberry.Schema(query=Query)
query = "{ example }"
result = schema.execute_sync(query, root_value=Query())
asse... | 54 | 1,216 |
strawberry | tests/schema/test_resolvers.py | .py | # type: ignore
from typing import Any, Generic, NamedTuple, TypeVar
import pytest
import strawberry
from strawberry.exceptions import ConflictingArgumentsError
from strawberry.parent import Parent
from strawberry.types.info import Info
def test_resolver():
@strawberry.type
class Query:
@strawberry.f... | 618 | 15,223 |
strawberry | tests/schema/test_lazy/type_c.py | .py | import sys
from typing import Annotated, Generic, TypeVar
import strawberry
T = TypeVar("T")
@strawberry.type
class TypeC:
name: str
@strawberry.type
class Edge(Generic[T]):
@strawberry.field
def node(self) -> T: # type: ignore
...
@strawberry.type
class Query:
type_a: Edge[TypeC]
t... | 30 | 520 |
strawberry | tests/schema/test_lazy/test_lazy_generic.py | .py | import os
import subprocess
import sys
import sysconfig
import textwrap
from collections.abc import Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Annotated, Generic, TypeVar
import pytest
import strawberry
if TYPE_CHECKING:
from tests.schema.test_lazy.type_a import TypeA
from tests.sche... | 192 | 4,312 |
strawberry | tests/schema/test_lazy/type_a.py | .py | from typing import TYPE_CHECKING, Annotated
import strawberry
if TYPE_CHECKING:
from .type_b import TypeB
@strawberry.type
class TypeA:
list_of_b: (
list[Annotated["TypeB", strawberry.lazy("tests.schema.test_lazy.type_b")]]
| None
) = None
@strawberry.field
def type_b(self) -> A... | 21 | 425 |
strawberry | tests/schema/test_lazy/type_e.py | .py | from enum import Enum
from typing import Annotated, Generic, TypeVar
import strawberry
T = TypeVar("T")
@strawberry.enum
class MyEnum(Enum):
ONE = "ONE"
@strawberry.type
class ValueContainer(Generic[T]):
value: T
UnionValue = Annotated[
ValueContainer[int] | ValueContainer[MyEnum],
strawberry.un... | 23 | 341 |
strawberry | tests/schema/test_lazy/type_b.py | .py | from typing import TYPE_CHECKING, Annotated
import strawberry
if TYPE_CHECKING:
from .type_a import TypeA
from .type_c import TypeC
ListTypeA = list[TypeA]
ListTypeC = list[TypeC]
else:
TypeA = Annotated["TypeA", strawberry.lazy("tests.schema.test_lazy.type_a")]
ListTypeA = list[
Anno... | 46 | 976 |
strawberry | tests/schema/test_lazy/test_lazy.py | .py | import textwrap
import strawberry
from strawberry.printer import print_schema
def test_cyclic_import():
from .type_a import TypeA
from .type_b import TypeB
@strawberry.type
class Query:
a: TypeA
b: TypeB
expected = """
type Query {
a: TypeA!
b: TypeB!
}
... | 41 | 642 |
strawberry | tests/schema/test_lazy/schema.py | .py | import strawberry
from tests.schema.test_lazy.type_c import Query
schema = strawberry.Schema(query=Query)
| 5 | 107 |
strawberry | tests/schema/test_lazy/type_d.py | .py | import sys
from typing import Annotated, Generic, TypeVar
import strawberry
T = TypeVar("T")
class Mixin(Generic[T]):
node: T
@strawberry.type
class TypeD(Mixin[int]):
name: str
@strawberry.type
class Query:
type_d_1: TypeD
type_d: Annotated["TypeD", strawberry.lazy("tests.schema.test_lazy.type_... | 27 | 443 |
strawberry | tests/schema/test_annotated/type_a.py | .py | from __future__ import annotations
from typing import Annotated
from uuid import UUID
import strawberry
@strawberry.type
class Query:
@strawberry.field
def get_testing(
self,
info: strawberry.Info,
id_: Annotated[UUID, strawberry.argument(name="id")],
) -> str | None: ...
| 17 | 313 |
strawberry | tests/schema/test_annotated/type_b.py | .py | from __future__ import annotations
from typing import Annotated
from uuid import UUID
import strawberry
@strawberry.type
class Query:
@strawberry.field
def get_testing(
self,
id_: Annotated[UUID, strawberry.argument(name="id")],
info: strawberry.Info,
) -> str | None: ...
| 17 | 313 |
strawberry | tests/schema/extensions/test_imports.py | .py | import pytest
def test_can_import(mocker):
# mocking sys.modules.ddtrace so we don't get an ImportError
mocker.patch.dict("sys.modules", ddtrace=mocker.MagicMock())
def test_fails_if_import_is_not_found():
with pytest.raises(ImportError):
from strawberry.extensions.tracing import Blueberry # no... | 12 | 329 |
strawberry | tests/schema/extensions/test_disable_introspection.py | .py | import strawberry
from strawberry.extensions import DisableIntrospection
def test_disables_introspection():
@strawberry.type
class Query:
hello: str
schema = strawberry.Schema(
query=Query,
extensions=[DisableIntrospection],
)
result = schema.execute_sync("query { __schem... | 41 | 1,066 |
strawberry | tests/schema/extensions/test_input_mutation_future.py | .py | from __future__ import annotations
import textwrap
from uuid import UUID
import strawberry
from strawberry.field_extensions import InputMutationExtension
@strawberry.type
class Query:
@strawberry.field
async def hello(self) -> str:
return "hi"
@strawberry.type
class Mutation:
@strawberry.mutat... | 50 | 916 |
strawberry | tests/schema/extensions/test_mask_errors.py | .py | from unittest.mock import Mock
import pytest
from graphql.error import GraphQLError
import strawberry
from strawberry.extensions import MaskErrors, ValidationCache
@pytest.mark.parametrize(
"query",
[
"query { testField( }",
"query { missingField }",
],
)
def test_mask_pre_execution_erro... | 317 | 8,879 |
strawberry | tests/schema/extensions/test_query_depth_limiter.py | .py | import pytest
from graphql import (
GraphQLError,
get_introspection_query,
parse,
specified_rules,
validate,
)
import strawberry
from strawberry.extensions import QueryDepthLimiter
from strawberry.extensions.query_depth_limiter import (
IgnoreContext,
ShouldIgnoreType,
create_validator,... | 495 | 9,956 |
strawberry | tests/schema/extensions/test_datadog.py | .py | import typing
from collections.abc import AsyncGenerator
from typing import Any
import pytest
import strawberry
from strawberry.schema.exceptions import InvalidOperationTypeError
from strawberry.types.graphql import OperationType
if typing.TYPE_CHECKING:
from strawberry.extensions.tracing.datadog import DatadogT... | 414 | 13,270 |
strawberry | tests/schema/extensions/test_max_aliases.py | .py | import strawberry
from strawberry.extensions.max_aliases import MaxAliasesLimiter
@strawberry.type
class Human:
name: str
email: str
@strawberry.type
class Query:
@strawberry.field
def user(self, name: str | None = None, email: str | None = None) -> Human:
return Human(name="Jane Doe", email... | 238 | 4,836 |
strawberry | tests/schema/extensions/test_max_tokens.py | .py | import pytest
import strawberry
from strawberry.extensions.max_tokens import MaxTokensLimiter
@strawberry.type
class Human:
name: str
email: str
@strawberry.type
class Query:
@strawberry.field
def user(self, name: str | None = None, email: str | None = None) -> Human:
return Human(name="Jan... | 95 | 1,931 |
strawberry | tests/schema/extensions/test_parser_cache.py | .py | from unittest.mock import patch
import pytest
from graphql import SourceLocation, parse
import strawberry
from strawberry.extensions import MaxTokensLimiter, ParserCache
from strawberry.extensions import parser_cache as _parser_cache_module
@pytest.fixture(autouse=True)
def _clear_parser_caches():
# ``ParserCac... | 194 | 5,143 |
strawberry | tests/schema/extensions/test_opentelemetry.py | .py | from typing import Any
from unittest.mock import MagicMock
import pytest
from opentelemetry.trace import SpanKind
from pytest_mock import MockerFixture
import strawberry
from strawberry.extensions.tracing.opentelemetry import (
OpenTelemetryExtension,
OpenTelemetryExtensionSync,
)
@pytest.fixture
def global... | 223 | 6,183 |
strawberry | tests/schema/extensions/test_field_extensions.py | .py | import re
from collections.abc import Callable
from typing import Annotated, Any
import pytest
import strawberry
from strawberry.extensions.field_extension import (
AsyncExtensionResolver,
FieldExtension,
SyncExtensionResolver,
)
from strawberry.schema.config import StrawberryConfig
class UpperCaseExten... | 461 | 13,989 |
strawberry | tests/schema/extensions/test_isolation.py | .py | """Regression suite for issue #4369.
Concurrent requests must each see their own ``ExecutionContext``, regardless
of whether the extension is passed as a class, a factory callable, or (the
deprecated path) a pre-built instance. Built-in tracing extensions must keep
their per-request mutable state isolated as well.
"""... | 217 | 7,150 |
strawberry | tests/schema/extensions/test_input_mutation_federation.py | .py | import textwrap
from typing import Annotated
import strawberry
from strawberry.field_extensions import InputMutationExtension
@strawberry.federation.type
class Fruit:
name: str
color: str
@strawberry.federation.type
class Query:
@strawberry.field
def hello(self) -> str: # pragma: no cover
... | 104 | 2,045 |
strawberry | tests/schema/extensions/test_validation_cache.py | .py | from unittest.mock import patch
import pytest
from graphql import validate
import strawberry
from strawberry.extensions import ValidationCache
from strawberry.extensions import validation_cache as _validation_cache_module
@pytest.fixture(autouse=True)
def _clear_validation_caches():
# ``ValidationCache`` shares... | 143 | 3,864 |
strawberry | tests/schema/extensions/test_stream_result.py | .py | import asyncio
from collections.abc import AsyncGenerator, AsyncIterator, Iterator
import pytest
import strawberry
from strawberry.extensions import MaskErrors, SchemaExtension
from strawberry.schema._graphql_core import (
InitialIncrementalExecutionResult,
SubsequentIncrementalExecutionResult,
)
from strawbe... | 309 | 9,346 |
strawberry | tests/schema/extensions/test_apollo.py | .py | import asyncio
from collections.abc import AsyncGenerator
import pytest
from freezegun import freeze_time
from graphql.utilities import get_introspection_query
import strawberry
from strawberry.extensions import SchemaExtension
from strawberry.extensions.tracing.apollo import (
ApolloTracingExtension,
ApolloT... | 347 | 9,964 |
strawberry | tests/schema/extensions/test_input_mutation.py | .py | import textwrap
from typing import Annotated
import strawberry
from strawberry.field_extensions import InputMutationExtension
from strawberry.permission import BasePermission
from strawberry.schema_directive import Location, schema_directive
@schema_directive(
locations=[Location.FIELD_DEFINITION],
name="som... | 207 | 5,084 |
strawberry | tests/schema/extensions/schema_extensions/test_defer_extensions.py | .py | import pytest
from inline_snapshot import snapshot
import strawberry
from strawberry.schema.config import StrawberryConfig
from tests.conftest import skip_if_gql_32
from tests.schema.extensions.schema_extensions.conftest import (
ExampleExtension,
)
pytestmark = skip_if_gql_32("GraphQL 3.3.0 is required for incre... | 84 | 2,209 |
strawberry | tests/schema/extensions/schema_extensions/test_subscription.py | .py | from collections.abc import AsyncGenerator
import pytest
import strawberry
from strawberry.extensions import SchemaExtension
from strawberry.types.execution import ExecutionResult, PreExecutionError
from tests.conftest import skip_if_gql_32
from .conftest import ExampleExtension, SchemaHelper
pytestmark = skip_if_g... | 212 | 6,573 |
strawberry | tests/schema/extensions/schema_extensions/test_extensions.py | .py | import contextlib
import json
from typing import Any
from unittest.mock import patch
import pytest
from graphql import ExecutionResult as GraphQLExecutionResult
from graphql import GraphQLError
from graphql import execute as original_execute
import strawberry
from strawberry.exceptions import StrawberryGraphQLError
f... | 1,010 | 28,213 |
strawberry | tests/schema/extensions/schema_extensions/conftest.py | .py | import contextlib
import dataclasses
import enum
from collections.abc import AsyncGenerator
from typing import Any
import pytest
import strawberry
from strawberry.extensions import SchemaExtension
@dataclasses.dataclass
class SchemaHelper:
query_type: type
subscription_type: type
query: str
subscrip... | 125 | 3,178 |
strawberry | tests/schema/validation_rules/test_maybe_null.py | .py | import strawberry
def test_maybe_null_validation_rule_input_fields():
"""Test MaybeNullValidationRule validates input object fields correctly."""
@strawberry.input
class TestInput:
strict_field: strawberry.Maybe[str] # Should reject null
flexible_field: strawberry.Maybe[str | None] # Sh... | 263 | 7,645 |
strawberry | tests/schema/test_same_origin_reprocess/test_same_origin.py | .py | import sys
from typing import TYPE_CHECKING, Annotated
import strawberry
def test_no_false_positive_duplicate_for_same_origin():
"""Test that we have no false-positive DuplicatedTypeName.
A lazy import triggers mid-construction, which re-decorates the Fruit class
(simulating what strawberry-django's fil... | 78 | 2,829 |
strawberry | tests/schema/test_same_origin_reprocess/type_fruit.py | .py | import strawberry
@strawberry.type
class Fruit:
name: str
| 7 | 64 |
strawberry | tests/schema/test_same_origin_reprocess/reprocess.py | .py | import strawberry
from .type_fruit import Fruit
# Simulate what a third-party decorator (e.g. strawberry-django's filter_type) does:
# re-process a type, creating a new StrawberryObjectDefinition for the same origin class.
strawberry.type(Fruit)
@strawberry.type
class FruitBowl:
fruit: Fruit
| 13 | 301 |
strawberry | tests/schema/test_lazy_types/type_a.py | .py | from typing import TYPE_CHECKING, Annotated
import strawberry
if TYPE_CHECKING:
from .type_b import TypeB
@strawberry.type
class TypeA:
list_of_b: (
list[Annotated["TypeB", strawberry.lazy("tests.schema.test_lazy_types.type_b")]]
| None
) = None
@strawberry.field
def type_b(self... | 21 | 431 |
strawberry | tests/schema/test_lazy_types/type_b.py | .py | from typing import TYPE_CHECKING, Annotated
import strawberry
if TYPE_CHECKING:
from .type_a import TypeA
@strawberry.type
class TypeB:
@strawberry.field()
def type_a(
self,
) -> Annotated["TypeA", strawberry.lazy("tests.schema.test_lazy_types.type_a")]:
from .type_a import TypeA
... | 18 | 341 |
strawberry | tests/schema/test_lazy_types/test_lazy_enums.py | .py | import enum
import textwrap
from typing import Annotated
import strawberry
from strawberry.printer import print_schema
@strawberry.enum
class LazyEnum(enum.Enum):
BREAD = "BREAD"
def test_lazy_enum():
@strawberry.type
class Query:
a: Annotated[
"LazyEnum", strawberry.lazy("tests.sch... | 34 | 586 |
strawberry | tests/schema/test_lazy_types/test_lazy_unions.py | .py | import textwrap
from typing import Annotated, Union
import strawberry
from strawberry.printer import print_schema
@strawberry.type
class TypeA:
a: int
@strawberry.type
class TypeB:
b: int
ABUnion = Annotated[TypeA | TypeB, strawberry.union("ABUnion")]
# New syntax unions (without explicit types= argumen... | 156 | 3,417 |
strawberry | tests/schema/test_lazy_types/test_cyclic.py | .py | import textwrap
import strawberry
from strawberry.printer import print_schema
def test_cyclic_import():
from .type_a import TypeA
from .type_b import TypeB
@strawberry.type
class Query:
a: TypeA
b: TypeB
expected = """
type Query {
a: TypeA!
b: TypeB!
}
... | 35 | 544 |
strawberry | tests/schema/types/test_date.py | .py | import datetime
import pytest
from graphql import GraphQLError
import strawberry
from strawberry.types.execution import ExecutionResult
from strawberry.utils import IS_GQL_32
def test_serialization():
@strawberry.type
class Query:
@strawberry.field
def serialize(self) -> datetime.date:
... | 141 | 3,815 |
strawberry | tests/schema/types/test_uuid.py | .py | import uuid
import pytest
from graphql import GraphQLError
import strawberry
from strawberry.utils import IS_GQL_32
def test_uuid():
@strawberry.type
class Query:
@strawberry.field
def example_uuid_out(self) -> uuid.UUID:
return uuid.NAMESPACE_DNS
schema = strawberry.Schema(... | 123 | 3,337 |
strawberry | tests/schema/types/test_datetime.py | .py | import datetime
import dateutil.tz
import pytest
from graphql import GraphQLError
import strawberry
from strawberry.types.execution import ExecutionResult
from strawberry.utils import IS_GQL_32
@pytest.mark.parametrize(
("typing", "instance", "serialized"),
[
(datetime.date, datetime.date(2019, 10, ... | 191 | 5,422 |
strawberry | tests/schema/types/test_decimal.py | .py | from decimal import Decimal
from graphql import GraphQLError
import strawberry
from strawberry.utils import IS_GQL_32
def test_decimal():
@strawberry.type
class Query:
@strawberry.field
def example_decimal(self) -> Decimal:
return Decimal("3.14159")
schema = strawberry.Schem... | 116 | 3,179 |
strawberry | tests/schema/types/test_time.py | .py | import datetime
import pytest
from graphql import GraphQLError
import strawberry
from strawberry.types.execution import ExecutionResult
from strawberry.utils import IS_GQL_32
def test_serialization():
@strawberry.type
class Query:
@strawberry.field
def serialize(self) -> datetime.time:
... | 140 | 3,724 |
strawberry | federation-compatibility/schema.py | .py | from typing import Any, Optional
import strawberry
from strawberry.extensions.tracing import ApolloFederationTracingExtension
from strawberry.schema_directive import Location
# ------- data -------
dimension = {
"size": "small",
"weight": 1,
"unit": "kg",
}
user = {
"email": "support@apollographql.c... | 320 | 8,498 |
strawberry | e2e/app.py | .py | import asyncio # noqa: INP001
import random
from collections.abc import AsyncGenerator
from fastapi import FastAPI
import strawberry
from strawberry.fastapi import GraphQLRouter
from strawberry.schema.config import StrawberryConfig
from strawberry.subscriptions import (
GRAPHQL_SSE_PROTOCOL,
GRAPHQL_TRANSPOR... | 125 | 3,254 |
airflow | performance/tests/test_performance_dag_utils.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 50 | 1,833 |
airflow | performance/tests/test_performance_dag.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 168 | 5,731 |
airflow | performance/src/performance_dags/performance_dag/performance_dag.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 273 | 9,022 |
airflow | performance/src/performance_dags/performance_dag/performance_dag_utils.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 693 | 26,075 |
airflow | docker-stack-docs/conf.py | .py | # Disable Flake8 because of all the sphinx imports
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache ... | 238 | 9,144 |
airflow | docker-stack-docs/docker-examples/extending/embedding-dags/test_dag.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 49 | 1,678 |
airflow | airflow-ctl/docs/conf.py | .py | # Disable Flake8 because of all the sphinx imports
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache ... | 300 | 10,849 |
airflow | airflow-ctl/docs/images/diagrams/airflowctl_api_network_architecture_diagram.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 87 | 2,786 |
airflow | airflow-ctl/tests/conftest.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 80 | 3,068 |
airflow | airflow-ctl/tests/airflow_ctl/api/test_client.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 526 | 23,590 |
airflow | airflow-ctl/tests/airflow_ctl/api/test_operations.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2,404 | 96,733 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/test_cli_config.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 902 | 37,677 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/test_console_formatting.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 165 | 5,394 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/commands/test_version_command.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 69 | 2,849 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/commands/test_dag_command.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 693 | 25,976 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/commands/test_config_command.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 481 | 17,436 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/commands/test_task_command.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 634 | 24,223 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/commands/test_pool_command.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 214 | 8,807 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/commands/test_variable_command.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 156 | 5,513 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/commands/test_jobs_command.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 116 | 4,614 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/commands/test_connections_command.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 263 | 9,482 |
airflow | airflow-ctl/tests/airflow_ctl/ctl/commands/test_auth_command.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 498 | 20,045 |
airflow | airflow-ctl/src/airflowctl/exceptions.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 47 | 1,705 |
airflow | airflow-ctl/src/airflowctl/api/operations.py | .py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 903 | 36,316 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.