mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-23 01:56:54 +03:00
Improved test syntax
This commit is contained in:
parent
24cd190f95
commit
00c9cc95d4
|
@ -1,6 +1,7 @@
|
||||||
|
from graphql.core.type import GraphQLEnumValue
|
||||||
|
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import resolve_only_args
|
from graphene import resolve_only_args
|
||||||
from graphql.core.type import GraphQLEnumValue
|
|
||||||
|
|
||||||
from .data import get_character, get_droid, get_hero, get_human
|
from .data import get_character, get_droid, get_hero, get_human
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from py.test import raises
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from py.test import raises
|
||||||
|
|
||||||
import graphene
|
import graphene
|
||||||
from graphene.contrib.django.converter import convert_django_field
|
from graphene.contrib.django.converter import convert_django_field
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from mock import patch
|
|
||||||
|
|
||||||
from graphql.core.type import GraphQLInterfaceType, GraphQLObjectType
|
from graphql.core.type import GraphQLInterfaceType, GraphQLObjectType
|
||||||
|
from mock import patch
|
||||||
|
|
||||||
from graphene import Schema
|
from graphene import Schema
|
||||||
from graphene.contrib.django.types import DjangoInterface, DjangoNode
|
from graphene.contrib.django.types import DjangoInterface, DjangoNode
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import inspect
|
import inspect
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from graphene import signals
|
|
||||||
from graphql.core.execution.executor import Executor
|
from graphql.core.execution.executor import Executor
|
||||||
from graphql.core.execution.middlewares.sync import \
|
from graphql.core.execution.middlewares.sync import \
|
||||||
SynchronousExecutionMiddleware
|
SynchronousExecutionMiddleware
|
||||||
from graphql.core.type import GraphQLSchema as _GraphQLSchema
|
from graphql.core.type import GraphQLSchema as _GraphQLSchema
|
||||||
from graphql.core.utils.introspection_query import introspection_query
|
from graphql.core.utils.introspection_query import introspection_query
|
||||||
|
|
||||||
|
from graphene import signals
|
||||||
|
|
||||||
from .types.base import BaseType
|
from .types.base import BaseType
|
||||||
from .types.objecttype import BaseObjectType
|
from .types.objecttype import BaseObjectType
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
|
from graphql.core.type import (GraphQLBoolean, GraphQLField, GraphQLFloat,
|
||||||
|
GraphQLID, GraphQLInt, GraphQLNonNull,
|
||||||
|
GraphQLString)
|
||||||
from py.test import raises
|
from py.test import raises
|
||||||
|
|
||||||
from graphene.core.fields import (BooleanField, Field, FloatField, IDField,
|
from graphene.core.fields import (BooleanField, Field, FloatField, IDField,
|
||||||
IntField, NonNullField, StringField)
|
IntField, NonNullField, StringField)
|
||||||
from graphene.core.schema import Schema
|
from graphene.core.schema import Schema
|
||||||
from graphene.core.types import ObjectType
|
from graphene.core.types import ObjectType
|
||||||
from graphql.core.type import (GraphQLBoolean, GraphQLField, GraphQLFloat,
|
|
||||||
GraphQLID, GraphQLInt, GraphQLNonNull,
|
|
||||||
GraphQLString)
|
|
||||||
|
|
||||||
|
|
||||||
class MyOt(ObjectType):
|
class MyOt(ObjectType):
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
from graphql.core import graphql
|
||||||
|
from graphql.core.type import GraphQLSchema
|
||||||
|
|
||||||
from graphene.core.fields import Field
|
from graphene.core.fields import Field
|
||||||
from graphene.core.schema import Schema
|
from graphene.core.schema import Schema
|
||||||
from graphene.core.types import Interface, List, ObjectType, String
|
from graphene.core.types import Interface, List, ObjectType, String
|
||||||
from graphql.core import graphql
|
|
||||||
from graphql.core.type import GraphQLSchema
|
|
||||||
|
|
||||||
|
|
||||||
class Character(Interface):
|
class Character(Interface):
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
from graphql.core import graphql
|
||||||
from py.test import raises
|
from py.test import raises
|
||||||
|
|
||||||
from graphene import Interface, List, ObjectType, Schema, String
|
from graphene import Interface, List, ObjectType, Schema, String
|
||||||
from graphene.core.fields import Field
|
from graphene.core.fields import Field
|
||||||
from graphene.core.types.base import LazyType
|
from graphene.core.types.base import LazyType
|
||||||
from graphql.core import graphql
|
|
||||||
from tests.utils import assert_equal_lists
|
from tests.utils import assert_equal_lists
|
||||||
|
|
||||||
schema = Schema(name='My own schema')
|
schema = Schema(name='My own schema')
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from graphql.core.type import GraphQLList, GraphQLNonNull
|
from graphql.core.type import GraphQLList, GraphQLNonNull
|
||||||
|
|
||||||
from .base import LazyType, MountedType, MountType
|
from .base import LazyType, MountedType, MountType
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from graphql.core.type import GraphQLField, GraphQLInputObjectField
|
from graphql.core.type import GraphQLField, GraphQLInputObjectField
|
||||||
|
|
||||||
from ...utils import to_camel_case
|
from ...utils import to_camel_case
|
||||||
|
|
|
@ -4,11 +4,11 @@ from collections import OrderedDict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from graphene import signals
|
|
||||||
from graphql.core.type import (GraphQLInputObjectType, GraphQLInterfaceType,
|
from graphql.core.type import (GraphQLInputObjectType, GraphQLInterfaceType,
|
||||||
GraphQLObjectType, GraphQLUnionType)
|
GraphQLObjectType, GraphQLUnionType)
|
||||||
|
|
||||||
|
from graphene import signals
|
||||||
|
|
||||||
from ..exceptions import SkipField
|
from ..exceptions import SkipField
|
||||||
from ..options import Options
|
from ..options import Options
|
||||||
from .argument import ArgumentsGroup
|
from .argument import ArgumentsGroup
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
from graphql.core.type import GraphQLArgument
|
||||||
from pytest import raises
|
from pytest import raises
|
||||||
|
|
||||||
from graphene.core.schema import Schema
|
from graphene.core.schema import Schema
|
||||||
from graphene.core.types import ObjectType
|
from graphene.core.types import ObjectType
|
||||||
from graphql.core.type import GraphQLArgument
|
|
||||||
|
|
||||||
from ..argument import Argument, snake_case_args, to_arguments
|
from ..argument import Argument, snake_case_args, to_arguments
|
||||||
from ..scalars import String
|
from ..scalars import String
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from graphene.core.schema import Schema
|
|
||||||
from graphql.core.type import GraphQLList, GraphQLNonNull, GraphQLString
|
from graphql.core.type import GraphQLList, GraphQLNonNull, GraphQLString
|
||||||
|
|
||||||
|
from graphene.core.schema import Schema
|
||||||
|
|
||||||
from ..definitions import List, NonNull
|
from ..definitions import List, NonNull
|
||||||
from ..scalars import String
|
from ..scalars import String
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
from graphene.core.schema import Schema
|
|
||||||
from graphene.core.types import InputObjectType, ObjectType
|
|
||||||
from graphql.core.type import (GraphQLField, GraphQLInputObjectField,
|
from graphql.core.type import (GraphQLField, GraphQLInputObjectField,
|
||||||
GraphQLString)
|
GraphQLString)
|
||||||
|
|
||||||
|
from graphene.core.schema import Schema
|
||||||
|
from graphene.core.types import InputObjectType, ObjectType
|
||||||
|
|
||||||
from ..base import LazyType
|
from ..base import LazyType
|
||||||
from ..definitions import List
|
from ..definitions import List
|
||||||
from ..field import Field, InputField
|
from ..field import Field, InputField
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from py.test import raises
|
|
||||||
|
|
||||||
from graphene.core.schema import Schema
|
|
||||||
from graphene.core.types import Int, Interface, String
|
|
||||||
from graphql.core.execution.middlewares.utils import (resolver_has_tag,
|
from graphql.core.execution.middlewares.utils import (resolver_has_tag,
|
||||||
tag_resolver)
|
tag_resolver)
|
||||||
from graphql.core.type import (GraphQLInterfaceType, GraphQLObjectType,
|
from graphql.core.type import (GraphQLInterfaceType, GraphQLObjectType,
|
||||||
GraphQLUnionType)
|
GraphQLUnionType)
|
||||||
|
from py.test import raises
|
||||||
|
|
||||||
|
from graphene.core.schema import Schema
|
||||||
|
from graphene.core.types import Int, Interface, String
|
||||||
|
|
||||||
|
|
||||||
class Character(Interface):
|
class Character(Interface):
|
||||||
|
@ -38,12 +38,10 @@ class Human(Character):
|
||||||
|
|
||||||
class Droid(Character):
|
class Droid(Character):
|
||||||
'''Droid description'''
|
'''Droid description'''
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class CharacterType(Droid, Human):
|
class CharacterType(Droid, Human):
|
||||||
'''Union Type'''
|
'''Union Type'''
|
||||||
pass
|
|
||||||
|
|
||||||
schema = Schema()
|
schema = Schema()
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
from graphene.core.schema import Schema
|
|
||||||
from graphql.core.type import (GraphQLBoolean, GraphQLFloat, GraphQLID,
|
from graphql.core.type import (GraphQLBoolean, GraphQLFloat, GraphQLID,
|
||||||
GraphQLInt, GraphQLScalarType, GraphQLString)
|
GraphQLInt, GraphQLScalarType, GraphQLString)
|
||||||
|
|
||||||
|
from graphene.core.schema import Schema
|
||||||
|
|
||||||
from ..scalars import ID, Boolean, Float, Int, Scalar, String
|
from ..scalars import ID, Boolean, Float, Int, Scalar, String
|
||||||
|
|
||||||
schema = Schema()
|
schema = Schema()
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
from graphql.core.type import GraphQLInputObjectField
|
||||||
|
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import relay
|
from graphene import relay
|
||||||
from graphene.core.schema import Schema
|
from graphene.core.schema import Schema
|
||||||
from graphql.core.type import GraphQLInputObjectField
|
|
||||||
|
|
||||||
my_id = 0
|
my_id = 0
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
from graphql.core.type import GraphQLID, GraphQLNonNull
|
||||||
|
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import relay
|
from graphene import relay
|
||||||
from graphql.core.type import GraphQLID, GraphQLNonNull
|
|
||||||
|
|
||||||
schema = graphene.Schema()
|
schema = graphene.Schema()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user