Run black formatter via pre-commit on all files

This commit is contained in:
Daniel Gallagher 2018-07-06 14:03:15 -07:00
parent 086f9dda99
commit 142f4a58d8
48 changed files with 18 additions and 206 deletions

View File

@ -14,11 +14,11 @@ repos:
- --autofix - --autofix
- id: flake8 - id: flake8
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v1.2.0 rev: v1.4.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
- repo: https://github.com/ambv/black - repo: https://github.com/ambv/black
rev: stable rev: 18.6b4
hooks: hooks:
- id: black - id: black
language_version: python3.6 language_version: python3.6

View File

@ -22,7 +22,6 @@ class Query(graphene.ObjectType):
class CreateAddress(graphene.Mutation): class CreateAddress(graphene.Mutation):
class Arguments: class Arguments:
geo = GeoInput(required=True) geo = GeoInput(required=True)

View File

@ -21,7 +21,6 @@ class Character(graphene.Interface):
class Human(graphene.ObjectType): class Human(graphene.ObjectType):
class Meta: class Meta:
interfaces = (Character,) interfaces = (Character,)
@ -29,7 +28,6 @@ class Human(graphene.ObjectType):
class Droid(graphene.ObjectType): class Droid(graphene.ObjectType):
class Meta: class Meta:
interfaces = (Character,) interfaces = (Character,)

View File

@ -18,7 +18,6 @@ class Ship(graphene.ObjectType):
class ShipConnection(relay.Connection): class ShipConnection(relay.Connection):
class Meta: class Meta:
node = Ship node = Ship
@ -44,7 +43,6 @@ class Faction(graphene.ObjectType):
class IntroduceShip(relay.ClientIDMutation): class IntroduceShip(relay.ClientIDMutation):
class Input: class Input:
ship_name = graphene.String(required=True) ship_name = graphene.String(required=True)
faction_id = graphene.String(required=True) faction_id = graphene.String(required=True)

View File

@ -208,7 +208,7 @@ class EnumMeta(type):
invalid_names = set(members) & {"mro"} invalid_names = set(members) & {"mro"}
if invalid_names: if invalid_names:
raise ValueError( raise ValueError(
"Invalid enum member name(s): %s" % (", ".join(invalid_names),) "Invalid enum member name(s): {}".format(", ".join(invalid_names))
) )
# save attributes from super classes so we know if we can take # save attributes from super classes so we know if we can take
@ -682,7 +682,7 @@ def __new__(cls, value):
for member in cls._member_map_.values(): for member in cls._member_map_.values():
if member.value == value: if member.value == value:
return member return member
raise ValueError("%s is not a valid %s" % (value, cls.__name__)) raise ValueError("{} is not a valid {}".format(value, cls.__name__))
temp_enum_dict["__new__"] = __new__ temp_enum_dict["__new__"] = __new__
@ -690,7 +690,7 @@ del __new__
def __repr__(self): def __repr__(self):
return "<%s.%s: %r>" % (self.__class__.__name__, self._name_, self._value_) return "<{}.{}: {!r}>".format(self.__class__.__name__, self._name_, self._value_)
temp_enum_dict["__repr__"] = __repr__ temp_enum_dict["__repr__"] = __repr__
@ -698,7 +698,7 @@ del __repr__
def __str__(self): def __str__(self):
return "%s.%s" % (self.__class__.__name__, self._name_) return "{}.{}".format(self.__class__.__name__, self._name_)
temp_enum_dict["__str__"] = __str__ temp_enum_dict["__str__"] = __str__
@ -907,9 +907,9 @@ def unique(enumeration):
duplicates.append((name, member.name)) duplicates.append((name, member.name))
if duplicates: if duplicates:
duplicate_names = ", ".join( duplicate_names = ", ".join(
["%s -> %s" % (alias, name) for (alias, name) in duplicates] ["{} -> {}".format(alias, name) for (alias, name) in duplicates]
) )
raise ValueError( raise ValueError(
"duplicate names found in %r: %s" % (enumeration, duplicate_names) "duplicate names found in {!r}: {}".format(enumeration, duplicate_names)
) )
return enumeration return enumeration

View File

@ -186,7 +186,6 @@ class _empty(object):
class _ParameterKind(int): class _ParameterKind(int):
def __new__(self, *args, **kwargs): def __new__(self, *args, **kwargs):
obj = int.__new__(self, *args) obj = int.__new__(self, *args)
obj._name = kwargs["name"] obj._name = kwargs["name"]

View File

@ -40,7 +40,6 @@ class ConnectionOptions(ObjectTypeOptions):
class Connection(ObjectType): class Connection(ObjectType):
class Meta: class Meta:
abstract = True abstract = True
@ -88,7 +87,6 @@ class Connection(ObjectType):
class IterableConnectionField(Field): class IterableConnectionField(Field):
def __init__(self, type, *args, **kwargs): def __init__(self, type, *args, **kwargs):
kwargs.setdefault("before", String()) kwargs.setdefault("before", String())
kwargs.setdefault("after", String()) kwargs.setdefault("after", String())

View File

@ -8,7 +8,6 @@ from ..types.mutation import Mutation
class ClientIDMutation(Mutation): class ClientIDMutation(Mutation):
class Meta: class Meta:
abstract = True abstract = True
@ -58,7 +57,6 @@ class ClientIDMutation(Mutation):
@classmethod @classmethod
def mutate(cls, root, info, input): def mutate(cls, root, info, input):
def on_resolve(payload): def on_resolve(payload):
try: try:
payload.client_mutation_id = input.get("client_mutation_id") payload.client_mutation_id = input.get("client_mutation_id")

View File

@ -27,7 +27,6 @@ def is_node(objecttype):
class GlobalID(Field): class GlobalID(Field):
def __init__(self, node=None, parent_type=None, required=True, *args, **kwargs): def __init__(self, node=None, parent_type=None, required=True, *args, **kwargs):
super(GlobalID, self).__init__(ID, required=required, *args, **kwargs) super(GlobalID, self).__init__(ID, required=required, *args, **kwargs)
self.node = node or Node self.node = node or Node
@ -49,7 +48,6 @@ class GlobalID(Field):
class NodeField(Field): class NodeField(Field):
def __init__(self, node, type=False, deprecation_reason=None, name=None, **kwargs): def __init__(self, node, type=False, deprecation_reason=None, name=None, **kwargs):
assert issubclass(node, Node), "NodeField can only operate in Nodes" assert issubclass(node, Node), "NodeField can only operate in Nodes"
self.node_type = node self.node_type = node
@ -68,7 +66,6 @@ class NodeField(Field):
class AbstractNode(Interface): class AbstractNode(Interface):
class Meta: class Meta:
abstract = True abstract = True

View File

@ -6,7 +6,6 @@ from ..node import Node
class MyObject(ObjectType): class MyObject(ObjectType):
class Meta: class Meta:
interfaces = [Node] interfaces = [Node]
@ -14,7 +13,6 @@ class MyObject(ObjectType):
def test_connection(): def test_connection():
class MyObjectConnection(Connection): class MyObjectConnection(Connection):
extra = String() extra = String()
@ -41,12 +39,10 @@ def test_connection():
def test_connection_inherit_abstracttype(): def test_connection_inherit_abstracttype():
class BaseConnection(object): class BaseConnection(object):
extra = String() extra = String()
class MyObjectConnection(BaseConnection, Connection): class MyObjectConnection(BaseConnection, Connection):
class Meta: class Meta:
node = MyObject node = MyObject
@ -62,7 +58,6 @@ def test_connection_name():
extra = String() extra = String()
class MyObjectConnection(BaseConnection, Connection): class MyObjectConnection(BaseConnection, Connection):
class Meta: class Meta:
node = MyObject node = MyObject
name = custom_name name = custom_name
@ -71,9 +66,7 @@ def test_connection_name():
def test_edge(): def test_edge():
class MyObjectConnection(Connection): class MyObjectConnection(Connection):
class Meta: class Meta:
node = MyObject node = MyObject
@ -93,12 +86,10 @@ def test_edge():
def test_edge_with_bases(): def test_edge_with_bases():
class BaseEdge(object): class BaseEdge(object):
extra = String() extra = String()
class MyObjectConnection(Connection): class MyObjectConnection(Connection):
class Meta: class Meta:
node = MyObject node = MyObject
@ -129,9 +120,7 @@ def test_pageinfo():
def test_connectionfield(): def test_connectionfield():
class MyObjectConnection(Connection): class MyObjectConnection(Connection):
class Meta: class Meta:
node = MyObject node = MyObject
@ -155,9 +144,7 @@ def test_connectionfield_node_deprecated():
def test_connectionfield_custom_args(): def test_connectionfield_custom_args():
class MyObjectConnection(Connection): class MyObjectConnection(Connection):
class Meta: class Meta:
node = MyObject node = MyObject
@ -174,9 +161,7 @@ def test_connectionfield_custom_args():
def test_connectionfield_required(): def test_connectionfield_required():
class MyObjectConnection(Connection): class MyObjectConnection(Connection):
class Meta: class Meta:
node = MyObject node = MyObject

View File

@ -11,7 +11,6 @@ letter_chars = ["A", "B", "C", "D", "E"]
class Letter(ObjectType): class Letter(ObjectType):
class Meta: class Meta:
interfaces = (Node,) interfaces = (Node,)
@ -19,7 +18,6 @@ class Letter(ObjectType):
class LetterConnection(Connection): class LetterConnection(Connection):
class Meta: class Meta:
node = Letter node = Letter

View File

@ -6,13 +6,11 @@ from ..node import GlobalID, Node
class CustomNode(Node): class CustomNode(Node):
class Meta: class Meta:
name = "Node" name = "Node"
class User(ObjectType): class User(ObjectType):
class Meta: class Meta:
interfaces = [CustomNode] interfaces = [CustomNode]
@ -20,7 +18,6 @@ class User(ObjectType):
class Info(object): class Info(object):
def __init__(self, parent_type): def __init__(self, parent_type):
self.parent_type = GrapheneObjectType( self.parent_type = GrapheneObjectType(
graphene_type=parent_type, graphene_type=parent_type,

View File

@ -27,7 +27,6 @@ class MyNode(ObjectType):
class SaySomething(ClientIDMutation): class SaySomething(ClientIDMutation):
class Input: class Input:
what = String() what = String()
@ -46,7 +45,6 @@ class FixedSaySomething(object):
class SaySomethingFixed(ClientIDMutation): class SaySomethingFixed(ClientIDMutation):
class Input: class Input:
what = String() what = String()
@ -58,7 +56,6 @@ class SaySomethingFixed(ClientIDMutation):
class SaySomethingPromise(ClientIDMutation): class SaySomethingPromise(ClientIDMutation):
class Input: class Input:
what = String() what = String()
@ -76,7 +73,6 @@ class MyEdge(ObjectType):
class OtherMutation(ClientIDMutation): class OtherMutation(ClientIDMutation):
class Input(SharedFields): class Input(SharedFields):
additional_field = String() additional_field = String()

View File

@ -16,7 +16,6 @@ class SharedNodeFields(object):
class MyNode(ObjectType): class MyNode(ObjectType):
class Meta: class Meta:
interfaces = (Node,) interfaces = (Node,)

View File

@ -6,7 +6,6 @@ from ..node import Node
class CustomNode(Node): class CustomNode(Node):
class Meta: class Meta:
name = "Node" name = "Node"
@ -28,7 +27,6 @@ class BasePhoto(Interface):
class User(ObjectType): class User(ObjectType):
class Meta: class Meta:
interfaces = [CustomNode] interfaces = [CustomNode]
@ -36,7 +34,6 @@ class User(ObjectType):
class Photo(ObjectType): class Photo(ObjectType):
class Meta: class Meta:
interfaces = [CustomNode, BasePhoto] interfaces = [CustomNode, BasePhoto]

View File

@ -27,7 +27,6 @@ def format_execution_result(execution_result, format_error):
class Client(object): class Client(object):
def __init__(self, schema, format_error=None, **execute_options): def __init__(self, schema, format_error=None, **execute_options):
assert isinstance(schema, Schema) assert isinstance(schema, Schema)
self.schema = schema self.schema = schema

View File

@ -16,13 +16,11 @@ class Error(graphene.ObjectType):
class CreatePostResult(graphene.Union): class CreatePostResult(graphene.Union):
class Meta: class Meta:
types = [Success, Error] types = [Success, Error]
class CreatePost(graphene.Mutation): class CreatePost(graphene.Mutation):
class Input: class Input:
text = graphene.String(required=True) text = graphene.String(required=True)

View File

@ -15,13 +15,11 @@ class SomeTypeTwo(graphene.ObjectType):
class MyUnion(graphene.Union): class MyUnion(graphene.Union):
class Meta: class Meta:
types = (SomeTypeOne, SomeTypeTwo) types = (SomeTypeOne, SomeTypeTwo)
def test_issue(): def test_issue():
class Query(graphene.ObjectType): class Query(graphene.ObjectType):
things = relay.ConnectionField(MyUnion) things = relay.ConnectionField(MyUnion)

View File

@ -12,7 +12,6 @@ class SpecialOptions(ObjectTypeOptions):
class SpecialObjectType(ObjectType): class SpecialObjectType(ObjectType):
@classmethod @classmethod
def __init_subclass_with_meta__(cls, other_attr="default", **options): def __init_subclass_with_meta__(cls, other_attr="default", **options):
_meta = SpecialOptions(cls) _meta = SpecialOptions(cls)
@ -23,9 +22,7 @@ class SpecialObjectType(ObjectType):
def test_special_objecttype_could_be_subclassed(): def test_special_objecttype_could_be_subclassed():
class MyType(SpecialObjectType): class MyType(SpecialObjectType):
class Meta: class Meta:
other_attr = "yeah!" other_attr = "yeah!"
@ -33,7 +30,6 @@ def test_special_objecttype_could_be_subclassed():
def test_special_objecttype_could_be_subclassed_default(): def test_special_objecttype_could_be_subclassed_default():
class MyType(SpecialObjectType): class MyType(SpecialObjectType):
pass pass
@ -41,7 +37,6 @@ def test_special_objecttype_could_be_subclassed_default():
def test_special_objecttype_inherit_meta_options(): def test_special_objecttype_inherit_meta_options():
class MyType(SpecialObjectType): class MyType(SpecialObjectType):
pass pass
@ -56,7 +51,6 @@ class SpecialInputObjectTypeOptions(ObjectTypeOptions):
class SpecialInputObjectType(InputObjectType): class SpecialInputObjectType(InputObjectType):
@classmethod @classmethod
def __init_subclass_with_meta__(cls, other_attr="default", **options): def __init_subclass_with_meta__(cls, other_attr="default", **options):
_meta = SpecialInputObjectTypeOptions(cls) _meta = SpecialInputObjectTypeOptions(cls)
@ -67,9 +61,7 @@ class SpecialInputObjectType(InputObjectType):
def test_special_inputobjecttype_could_be_subclassed(): def test_special_inputobjecttype_could_be_subclassed():
class MyInputObjectType(SpecialInputObjectType): class MyInputObjectType(SpecialInputObjectType):
class Meta: class Meta:
other_attr = "yeah!" other_attr = "yeah!"
@ -77,7 +69,6 @@ def test_special_inputobjecttype_could_be_subclassed():
def test_special_inputobjecttype_could_be_subclassed_default(): def test_special_inputobjecttype_could_be_subclassed_default():
class MyInputObjectType(SpecialInputObjectType): class MyInputObjectType(SpecialInputObjectType):
pass pass
@ -85,7 +76,6 @@ def test_special_inputobjecttype_could_be_subclassed_default():
def test_special_inputobjecttype_inherit_meta_options(): def test_special_inputobjecttype_inherit_meta_options():
class MyInputObjectType(SpecialInputObjectType): class MyInputObjectType(SpecialInputObjectType):
pass pass
@ -98,7 +88,6 @@ class SpecialEnumOptions(EnumOptions):
class SpecialEnum(Enum): class SpecialEnum(Enum):
@classmethod @classmethod
def __init_subclass_with_meta__(cls, other_attr="default", **options): def __init_subclass_with_meta__(cls, other_attr="default", **options):
_meta = SpecialEnumOptions(cls) _meta = SpecialEnumOptions(cls)
@ -107,9 +96,7 @@ class SpecialEnum(Enum):
def test_special_enum_could_be_subclassed(): def test_special_enum_could_be_subclassed():
class MyEnum(SpecialEnum): class MyEnum(SpecialEnum):
class Meta: class Meta:
other_attr = "yeah!" other_attr = "yeah!"
@ -117,7 +104,6 @@ def test_special_enum_could_be_subclassed():
def test_special_enum_could_be_subclassed_default(): def test_special_enum_could_be_subclassed_default():
class MyEnum(SpecialEnum): class MyEnum(SpecialEnum):
pass pass
@ -125,7 +111,6 @@ def test_special_enum_could_be_subclassed_default():
def test_special_enum_inherit_meta_options(): def test_special_enum_inherit_meta_options():
class MyEnum(SpecialEnum): class MyEnum(SpecialEnum):
pass pass

View File

@ -7,7 +7,6 @@ import graphene
class MyInputClass(graphene.InputObjectType): class MyInputClass(graphene.InputObjectType):
@classmethod @classmethod
def __init_subclass_with_meta__( def __init_subclass_with_meta__(
cls, container=None, _meta=None, fields=None, **options cls, container=None, _meta=None, fields=None, **options
@ -21,7 +20,6 @@ class MyInputClass(graphene.InputObjectType):
class MyInput(MyInputClass): class MyInput(MyInputClass):
class Meta: class Meta:
fields = dict(x=graphene.Field(graphene.Int)) fields = dict(x=graphene.Field(graphene.Int))

View File

@ -3,7 +3,6 @@ from ..utils.subclass_with_meta import SubclassWithMeta
class AbstractType(SubclassWithMeta): class AbstractType(SubclassWithMeta):
def __init_subclass__(cls, *args, **kwargs): def __init_subclass__(cls, *args, **kwargs):
warn_deprecation( warn_deprecation(
"Abstract type is deprecated, please use normal object inheritance instead.\n" "Abstract type is deprecated, please use normal object inheritance instead.\n"

View File

@ -8,7 +8,6 @@ from .utils import get_type
class Argument(MountedType): class Argument(MountedType):
def __init__( def __init__(
self, self,
type, type,

View File

@ -25,7 +25,6 @@ class BaseOptions(object):
class BaseType(SubclassWithMeta): class BaseType(SubclassWithMeta):
@classmethod @classmethod
def create_type(cls, class_name, **options): def create_type(cls, class_name, **options):
return type(class_name, (cls,), {"Meta": options}) return type(class_name, (cls,), {"Meta": options})

View File

@ -1,5 +1,4 @@
class Context(object): class Context(object):
def __init__(self, **params): def __init__(self, **params):
for key, value in params.items(): for key, value in params.items():
setattr(self, key, value) setattr(self, key, value)

View File

@ -24,7 +24,6 @@ class EnumOptions(BaseOptions):
class EnumMeta(SubclassWithMeta_Meta): class EnumMeta(SubclassWithMeta_Meta):
def __new__(cls, name, bases, classdict, **options): def __new__(cls, name, bases, classdict, **options):
enum_members = OrderedDict(classdict, __eq__=eq_enum) enum_members = OrderedDict(classdict, __eq__=eq_enum)
# We remove the Meta attribute from the class to not collide # We remove the Meta attribute from the class to not collide
@ -63,7 +62,6 @@ class EnumMeta(SubclassWithMeta_Meta):
class Enum(six.with_metaclass(EnumMeta, UnmountedType, BaseType)): class Enum(six.with_metaclass(EnumMeta, UnmountedType, BaseType)):
@classmethod @classmethod
def __init_subclass_with_meta__(cls, enum=None, _meta=None, **options): def __init_subclass_with_meta__(cls, enum=None, _meta=None, **options):
if not _meta: if not _meta:

View File

@ -19,7 +19,6 @@ def source_resolver(source, root, info, **args):
class Field(MountedType): class Field(MountedType):
def __init__( def __init__(
self, self,
type, type,

View File

@ -4,7 +4,6 @@ from .utils import get_type
class InputField(MountedType): class InputField(MountedType):
def __init__( def __init__(
self, self,
type, type,

View File

@ -17,7 +17,6 @@ class InputObjectTypeOptions(BaseOptions):
class InputObjectTypeContainer(dict, BaseType): class InputObjectTypeContainer(dict, BaseType):
class Meta: class Meta:
abstract = True abstract = True

View File

@ -3,7 +3,6 @@ from .unmountedtype import UnmountedType
class MountedType(OrderedType): class MountedType(OrderedType):
@classmethod @classmethod
def mounted(cls, unmounted): # noqa: N802 def mounted(cls, unmounted): # noqa: N802
""" """

View File

@ -10,7 +10,6 @@ class MyType(ObjectType):
class MyScalar(UnmountedType): class MyScalar(UnmountedType):
def get_type(self): def get_type(self):
return MyType return MyType
@ -25,7 +24,6 @@ def test_abstract_objecttype_warn_deprecation(mocker):
def test_generate_objecttype_inherit_abstracttype(): def test_generate_objecttype_inherit_abstracttype():
class MyAbstractType(AbstractType): class MyAbstractType(AbstractType):
field1 = MyScalar() field1 = MyScalar()

View File

@ -6,7 +6,6 @@ class CustomOptions(BaseOptions):
class CustomType(BaseType): class CustomType(BaseType):
@classmethod @classmethod
def __init_subclass_with_meta__(cls, **options): def __init_subclass_with_meta__(cls, **options):
_meta = CustomOptions(cls) _meta = CustomOptions(cls)
@ -14,7 +13,6 @@ class CustomType(BaseType):
def test_basetype(): def test_basetype():
class MyBaseType(CustomType): class MyBaseType(CustomType):
pass pass
@ -24,7 +22,6 @@ def test_basetype():
def test_basetype_nones(): def test_basetype_nones():
class MyBaseType(CustomType): class MyBaseType(CustomType):
"""Documentation""" """Documentation"""
@ -38,7 +35,6 @@ def test_basetype_nones():
def test_basetype_custom(): def test_basetype_custom():
class MyBaseType(CustomType): class MyBaseType(CustomType):
"""Documentation""" """Documentation"""

View File

@ -56,7 +56,6 @@ class MyInterface(Interface):
class MyUnion(Union): class MyUnion(Union):
class Meta: class Meta:
types = (Article,) types = (Article,)
@ -116,7 +115,6 @@ def test_defines_a_subscription_schema():
def test_includes_nested_input_objects_in_the_map(): def test_includes_nested_input_objects_in_the_map():
class NestedInputObject(InputObjectType): class NestedInputObject(InputObjectType):
value = String() value = String()
@ -135,12 +133,10 @@ def test_includes_nested_input_objects_in_the_map():
def test_includes_interfaces_thunk_subtypes_in_the_type_map(): def test_includes_interfaces_thunk_subtypes_in_the_type_map():
class SomeInterface(Interface): class SomeInterface(Interface):
f = Int() f = Int()
class SomeSubtype(ObjectType): class SomeSubtype(ObjectType):
class Meta: class Meta:
interfaces = (SomeInterface,) interfaces = (SomeInterface,)
@ -153,7 +149,6 @@ def test_includes_interfaces_thunk_subtypes_in_the_type_map():
def test_includes_types_in_union(): def test_includes_types_in_union():
class SomeType(ObjectType): class SomeType(ObjectType):
a = String() a = String()
@ -161,7 +156,6 @@ def test_includes_types_in_union():
b = String() b = String()
class MyUnion(Union): class MyUnion(Union):
class Meta: class Meta:
types = (SomeType, OtherType) types = (SomeType, OtherType)
@ -175,7 +169,6 @@ def test_includes_types_in_union():
def test_maps_enum(): def test_maps_enum():
class SomeType(ObjectType): class SomeType(ObjectType):
a = String() a = String()
@ -183,7 +176,6 @@ def test_maps_enum():
b = String() b = String()
class MyUnion(Union): class MyUnion(Union):
class Meta: class Meta:
types = (SomeType, OtherType) types = (SomeType, OtherType)
@ -197,12 +189,10 @@ def test_maps_enum():
def test_includes_interfaces_subtypes_in_the_type_map(): def test_includes_interfaces_subtypes_in_the_type_map():
class SomeInterface(Interface): class SomeInterface(Interface):
f = Int() f = Int()
class SomeSubtype(ObjectType): class SomeSubtype(ObjectType):
class Meta: class Meta:
interfaces = (SomeInterface,) interfaces = (SomeInterface,)
@ -293,7 +283,6 @@ def test_stringifies_simple_types():
def test_does_not_mutate_passed_field_definitions(): def test_does_not_mutate_passed_field_definitions():
class CommonFields(object): class CommonFields(object):
field1 = String() field1 = String()
field2 = String(id=String()) field2 = String(id=String())

View File

@ -30,7 +30,6 @@ def test_list_non_null():
def test_partial(): def test_partial():
def __type(_type): def __type(_type):
return _type return _type

View File

@ -8,9 +8,9 @@ from ..schema import ObjectType, Schema
def test_enum_construction(): def test_enum_construction():
class RGB(Enum): class RGB(Enum):
"""Description""" """Description"""
RED = 1 RED = 1
GREEN = 2 GREEN = 2
BLUE = 3 BLUE = 3
@ -32,9 +32,7 @@ def test_enum_construction():
def test_enum_construction_meta(): def test_enum_construction_meta():
class RGB(Enum): class RGB(Enum):
class Meta: class Meta:
name = "RGBEnum" name = "RGBEnum"
description = "Description" description = "Description"
@ -65,7 +63,6 @@ def test_enum_from_builtin_enum():
def test_enum_from_builtin_enum_accepts_lambda_description(): def test_enum_from_builtin_enum_accepts_lambda_description():
def custom_description(value): def custom_description(value):
if not value: if not value:
return "StarWars Episodes" return "StarWars Episodes"
@ -125,6 +122,7 @@ def test_enum_from_python3_enum_uses_enum_doc():
class Color(PyEnum): class Color(PyEnum):
"""This is the description""" """This is the description"""
RED = 1 RED = 1
GREEN = 2 GREEN = 2
BLUE = 3 BLUE = 3
@ -139,7 +137,6 @@ def test_enum_from_python3_enum_uses_enum_doc():
def test_enum_value_from_class(): def test_enum_value_from_class():
class RGB(Enum): class RGB(Enum):
RED = 1 RED = 1
GREEN = 2 GREEN = 2
@ -151,7 +148,6 @@ def test_enum_value_from_class():
def test_enum_value_as_unmounted_field(): def test_enum_value_as_unmounted_field():
class RGB(Enum): class RGB(Enum):
RED = 1 RED = 1
GREEN = 2 GREEN = 2
@ -164,7 +160,6 @@ def test_enum_value_as_unmounted_field():
def test_enum_value_as_unmounted_inputfield(): def test_enum_value_as_unmounted_inputfield():
class RGB(Enum): class RGB(Enum):
RED = 1 RED = 1
GREEN = 2 GREEN = 2
@ -177,7 +172,6 @@ def test_enum_value_as_unmounted_inputfield():
def test_enum_value_as_unmounted_argument(): def test_enum_value_as_unmounted_argument():
class RGB(Enum): class RGB(Enum):
RED = 1 RED = 1
GREEN = 2 GREEN = 2
@ -190,7 +184,6 @@ def test_enum_value_as_unmounted_argument():
def test_enum_can_be_compared(): def test_enum_can_be_compared():
class RGB(Enum): class RGB(Enum):
RED = 1 RED = 1
GREEN = 2 GREEN = 2
@ -202,7 +195,6 @@ def test_enum_can_be_compared():
def test_enum_can_be_initialzied(): def test_enum_can_be_initialzied():
class RGB(Enum): class RGB(Enum):
RED = 1 RED = 1
GREEN = 2 GREEN = 2
@ -214,7 +206,6 @@ def test_enum_can_be_initialzied():
def test_enum_can_retrieve_members(): def test_enum_can_retrieve_members():
class RGB(Enum): class RGB(Enum):
RED = 1 RED = 1
GREEN = 2 GREEN = 2
@ -226,7 +217,6 @@ def test_enum_can_retrieve_members():
def test_enum_to_enum_comparison_should_differ(): def test_enum_to_enum_comparison_should_differ():
class RGB1(Enum): class RGB1(Enum):
RED = 1 RED = 1
GREEN = 2 GREEN = 2
@ -243,9 +233,7 @@ def test_enum_to_enum_comparison_should_differ():
def test_enum_skip_meta_from_members(): def test_enum_skip_meta_from_members():
class RGB1(Enum): class RGB1(Enum):
class Meta: class Meta:
name = "RGB" name = "RGB"

View File

@ -14,13 +14,11 @@ class MyType(object):
class MyScalar(UnmountedType): class MyScalar(UnmountedType):
def get_type(self): def get_type(self):
return MyType return MyType
def test_generate_inputobjecttype(): def test_generate_inputobjecttype():
class MyInputObjectType(InputObjectType): class MyInputObjectType(InputObjectType):
"""Documentation""" """Documentation"""
@ -30,9 +28,7 @@ def test_generate_inputobjecttype():
def test_generate_inputobjecttype_with_meta(): def test_generate_inputobjecttype_with_meta():
class MyInputObjectType(InputObjectType): class MyInputObjectType(InputObjectType):
class Meta: class Meta:
name = "MyOtherInputObjectType" name = "MyOtherInputObjectType"
description = "Documentation" description = "Documentation"
@ -42,7 +38,6 @@ def test_generate_inputobjecttype_with_meta():
def test_generate_inputobjecttype_with_fields(): def test_generate_inputobjecttype_with_fields():
class MyInputObjectType(InputObjectType): class MyInputObjectType(InputObjectType):
field = Field(MyType) field = Field(MyType)
@ -50,7 +45,6 @@ def test_generate_inputobjecttype_with_fields():
def test_ordered_fields_in_inputobjecttype(): def test_ordered_fields_in_inputobjecttype():
class MyInputObjectType(InputObjectType): class MyInputObjectType(InputObjectType):
b = InputField(MyType) b = InputField(MyType)
a = InputField(MyType) a = InputField(MyType)
@ -61,7 +55,6 @@ def test_ordered_fields_in_inputobjecttype():
def test_generate_inputobjecttype_unmountedtype(): def test_generate_inputobjecttype_unmountedtype():
class MyInputObjectType(InputObjectType): class MyInputObjectType(InputObjectType):
field = MyScalar(MyType) field = MyScalar(MyType)
@ -70,7 +63,6 @@ def test_generate_inputobjecttype_unmountedtype():
def test_generate_inputobjecttype_as_argument(): def test_generate_inputobjecttype_as_argument():
class MyInputObjectType(InputObjectType): class MyInputObjectType(InputObjectType):
field = MyScalar() field = MyScalar()
@ -87,7 +79,6 @@ def test_generate_inputobjecttype_as_argument():
def test_generate_inputobjecttype_inherit_abstracttype(): def test_generate_inputobjecttype_inherit_abstracttype():
class MyAbstractType(object): class MyAbstractType(object):
field1 = MyScalar(MyType) field1 = MyScalar(MyType)
@ -102,7 +93,6 @@ def test_generate_inputobjecttype_inherit_abstracttype():
def test_generate_inputobjecttype_inherit_abstracttype_reversed(): def test_generate_inputobjecttype_inherit_abstracttype_reversed():
class MyAbstractType(object): class MyAbstractType(object):
field1 = MyScalar(MyType) field1 = MyScalar(MyType)
@ -117,7 +107,6 @@ def test_generate_inputobjecttype_inherit_abstracttype_reversed():
def test_inputobjecttype_of_input(): def test_inputobjecttype_of_input():
class Child(InputObjectType): class Child(InputObjectType):
first_name = String() first_name = String()
last_name = String() last_name = String()

View File

@ -8,13 +8,11 @@ class MyType(object):
class MyScalar(UnmountedType): class MyScalar(UnmountedType):
def get_type(self): def get_type(self):
return MyType return MyType
def test_generate_interface(): def test_generate_interface():
class MyInterface(Interface): class MyInterface(Interface):
"""Documentation""" """Documentation"""
@ -24,9 +22,7 @@ def test_generate_interface():
def test_generate_interface_with_meta(): def test_generate_interface_with_meta():
class MyInterface(Interface): class MyInterface(Interface):
class Meta: class Meta:
name = "MyOtherInterface" name = "MyOtherInterface"
description = "Documentation" description = "Documentation"
@ -36,7 +32,6 @@ def test_generate_interface_with_meta():
def test_generate_interface_with_fields(): def test_generate_interface_with_fields():
class MyInterface(Interface): class MyInterface(Interface):
field = Field(MyType) field = Field(MyType)
@ -44,7 +39,6 @@ def test_generate_interface_with_fields():
def test_ordered_fields_in_interface(): def test_ordered_fields_in_interface():
class MyInterface(Interface): class MyInterface(Interface):
b = Field(MyType) b = Field(MyType)
a = Field(MyType) a = Field(MyType)
@ -55,7 +49,6 @@ def test_ordered_fields_in_interface():
def test_generate_interface_unmountedtype(): def test_generate_interface_unmountedtype():
class MyInterface(Interface): class MyInterface(Interface):
field = MyScalar() field = MyScalar()
@ -64,7 +57,6 @@ def test_generate_interface_unmountedtype():
def test_generate_interface_inherit_abstracttype(): def test_generate_interface_inherit_abstracttype():
class MyAbstractType(object): class MyAbstractType(object):
field1 = MyScalar() field1 = MyScalar()
@ -76,7 +68,6 @@ def test_generate_interface_inherit_abstracttype():
def test_generate_interface_inherit_interface(): def test_generate_interface_inherit_interface():
class MyBaseInterface(Interface): class MyBaseInterface(Interface):
field1 = MyScalar() field1 = MyScalar()
@ -89,7 +80,6 @@ def test_generate_interface_inherit_interface():
def test_generate_interface_inherit_abstracttype_reversed(): def test_generate_interface_inherit_abstracttype_reversed():
class MyAbstractType(object): class MyAbstractType(object):
field1 = MyScalar() field1 = MyScalar()

View File

@ -4,7 +4,6 @@ from ..scalars import String
class CustomField(Field): class CustomField(Field):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.metadata = kwargs.pop("metadata", None) self.metadata = kwargs.pop("metadata", None)
super(CustomField, self).__init__(*args, **kwargs) super(CustomField, self).__init__(*args, **kwargs)

View File

@ -10,7 +10,6 @@ from ..structures import NonNull
def test_generate_mutation_no_args(): def test_generate_mutation_no_args():
class MyMutation(Mutation): class MyMutation(Mutation):
"""Documentation""" """Documentation"""
@ -25,9 +24,7 @@ def test_generate_mutation_no_args():
def test_generate_mutation_with_meta(): def test_generate_mutation_with_meta():
class MyMutation(Mutation): class MyMutation(Mutation):
class Meta: class Meta:
name = "MyOtherMutation" name = "MyOtherMutation"
description = "Documentation" description = "Documentation"
@ -51,12 +48,10 @@ def test_mutation_raises_exception_if_no_mutate():
def test_mutation_custom_output_type(): def test_mutation_custom_output_type():
class User(ObjectType): class User(ObjectType):
name = String() name = String()
class CreateUser(Mutation): class CreateUser(Mutation):
class Arguments: class Arguments:
name = String() name = String()
@ -74,9 +69,7 @@ def test_mutation_custom_output_type():
def test_mutation_execution(): def test_mutation_execution():
class CreateUser(Mutation): class CreateUser(Mutation):
class Arguments: class Arguments:
name = String() name = String()
dynamic = Dynamic(lambda: String()) dynamic = Dynamic(lambda: String())
@ -109,7 +102,6 @@ def test_mutation_execution():
def test_mutation_no_fields_output(): def test_mutation_no_fields_output():
class CreateUser(Mutation): class CreateUser(Mutation):
name = String() name = String()
@ -136,9 +128,7 @@ def test_mutation_no_fields_output():
def test_mutation_allow_to_have_custom_args(): def test_mutation_allow_to_have_custom_args():
class CreateUser(Mutation): class CreateUser(Mutation):
class Arguments: class Arguments:
name = String() name = String()

View File

@ -23,7 +23,6 @@ class MyInterface(Interface):
class ContainerWithInterface(ObjectType): class ContainerWithInterface(ObjectType):
class Meta: class Meta:
interfaces = (MyInterface,) interfaces = (MyInterface,)
@ -32,13 +31,11 @@ class ContainerWithInterface(ObjectType):
class MyScalar(UnmountedType): class MyScalar(UnmountedType):
def get_type(self): def get_type(self):
return MyType return MyType
def test_generate_objecttype(): def test_generate_objecttype():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
"""Documentation""" """Documentation"""
@ -53,9 +50,7 @@ def test_generate_objecttype():
def test_generate_objecttype_with_meta(): def test_generate_objecttype_with_meta():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
class Meta: class Meta:
name = "MyOtherObjectType" name = "MyOtherObjectType"
description = "Documentation" description = "Documentation"
@ -67,7 +62,6 @@ def test_generate_objecttype_with_meta():
def test_generate_lazy_objecttype(): def test_generate_lazy_objecttype():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
example = Field(lambda: InnerObjectType, required=True) example = Field(lambda: InnerObjectType, required=True)
@ -81,7 +75,6 @@ def test_generate_lazy_objecttype():
def test_generate_objecttype_with_fields(): def test_generate_objecttype_with_fields():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
field = Field(MyType) field = Field(MyType)
@ -89,7 +82,6 @@ def test_generate_objecttype_with_fields():
def test_generate_objecttype_with_private_attributes(): def test_generate_objecttype_with_private_attributes():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
_private_state = None _private_state = None
@ -104,7 +96,6 @@ def test_generate_objecttype_with_private_attributes():
def test_ordered_fields_in_objecttype(): def test_ordered_fields_in_objecttype():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
b = Field(MyType) b = Field(MyType)
a = Field(MyType) a = Field(MyType)
@ -115,7 +106,6 @@ def test_ordered_fields_in_objecttype():
def test_generate_objecttype_inherit_abstracttype(): def test_generate_objecttype_inherit_abstracttype():
class MyAbstractType(object): class MyAbstractType(object):
field1 = MyScalar() field1 = MyScalar()
@ -130,7 +120,6 @@ def test_generate_objecttype_inherit_abstracttype():
def test_generate_objecttype_inherit_abstracttype_reversed(): def test_generate_objecttype_inherit_abstracttype_reversed():
class MyAbstractType(object): class MyAbstractType(object):
field1 = MyScalar() field1 = MyScalar()
@ -145,7 +134,6 @@ def test_generate_objecttype_inherit_abstracttype_reversed():
def test_generate_objecttype_unmountedtype(): def test_generate_objecttype_unmountedtype():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
field = MyScalar() field = MyScalar()
@ -205,14 +193,12 @@ def test_objecttype_as_container_invalid_kwargs():
def test_objecttype_container_benchmark(benchmark): def test_objecttype_container_benchmark(benchmark):
@benchmark @benchmark
def create_objecttype(): def create_objecttype():
Container(field1="field1", field2="field2") Container(field1="field1", field2="field2")
def test_generate_objecttype_description(): def test_generate_objecttype_description():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
""" """
Documentation Documentation
@ -224,9 +210,7 @@ def test_generate_objecttype_description():
def test_objecttype_with_possible_types(): def test_objecttype_with_possible_types():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
class Meta: class Meta:
possible_types = (dict,) possible_types = (dict,)
@ -237,7 +221,6 @@ def test_objecttype_with_possible_types_and_is_type_of_should_raise():
with pytest.raises(AssertionError) as excinfo: with pytest.raises(AssertionError) as excinfo:
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
class Meta: class Meta:
possible_types = (dict,) possible_types = (dict,)
@ -252,7 +235,6 @@ def test_objecttype_with_possible_types_and_is_type_of_should_raise():
def test_objecttype_no_fields_output(): def test_objecttype_no_fields_output():
class User(ObjectType): class User(ObjectType):
name = String() name = String()
@ -276,9 +258,7 @@ def test_objecttype_no_fields_output():
def test_abstract_objecttype_can_str(): def test_abstract_objecttype_can_str():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
class Meta: class Meta:
abstract = True abstract = True

View File

@ -17,7 +17,6 @@ from ..union import Union
def test_query(): def test_query():
class Query(ObjectType): class Query(ObjectType):
hello = String(resolver=lambda *_: "World") hello = String(resolver=lambda *_: "World")
@ -29,7 +28,6 @@ def test_query():
def test_query_source(): def test_query_source():
class Root(object): class Root(object):
_hello = "World" _hello = "World"
@ -47,7 +45,6 @@ def test_query_source():
def test_query_union(): def test_query_union():
class one_object(object): class one_object(object):
pass pass
@ -69,7 +66,6 @@ def test_query_union():
return isinstance(root, two_object) return isinstance(root, two_object)
class MyUnion(Union): class MyUnion(Union):
class Meta: class Meta:
types = (One, Two) types = (One, Two)
@ -87,7 +83,6 @@ def test_query_union():
def test_query_interface(): def test_query_interface():
class one_object(object): class one_object(object):
pass pass
@ -98,7 +93,6 @@ def test_query_interface():
base = String() base = String()
class One(ObjectType): class One(ObjectType):
class Meta: class Meta:
interfaces = (MyInterface,) interfaces = (MyInterface,)
@ -109,7 +103,6 @@ def test_query_interface():
return isinstance(root, one_object) return isinstance(root, one_object)
class Two(ObjectType): class Two(ObjectType):
class Meta: class Meta:
interfaces = (MyInterface,) interfaces = (MyInterface,)
@ -135,7 +128,6 @@ def test_query_interface():
def test_query_dynamic(): def test_query_dynamic():
class Query(ObjectType): class Query(ObjectType):
hello = Dynamic(lambda: String(resolver=lambda *_: "World")) hello = Dynamic(lambda: String(resolver=lambda *_: "World"))
hellos = Dynamic(lambda: List(String, resolver=lambda *_: ["Worlds"])) hellos = Dynamic(lambda: List(String, resolver=lambda *_: ["Worlds"]))
@ -153,7 +145,6 @@ def test_query_dynamic():
def test_query_default_value(): def test_query_default_value():
class MyType(ObjectType): class MyType(ObjectType):
field = String() field = String()
@ -168,7 +159,6 @@ def test_query_default_value():
def test_query_wrong_default_value(): def test_query_wrong_default_value():
class MyType(ObjectType): class MyType(ObjectType):
field = String() field = String()
@ -191,7 +181,6 @@ def test_query_wrong_default_value():
def test_query_default_value_ignored_by_resolver(): def test_query_default_value_ignored_by_resolver():
class MyType(ObjectType): class MyType(ObjectType):
field = String() field = String()
@ -210,7 +199,6 @@ def test_query_default_value_ignored_by_resolver():
def test_query_resolve_function(): def test_query_resolve_function():
class Query(ObjectType): class Query(ObjectType):
hello = String() hello = String()
@ -225,7 +213,6 @@ def test_query_resolve_function():
def test_query_arguments(): def test_query_arguments():
class Query(ObjectType): class Query(ObjectType):
test = String(a_str=String(), a_int=Int()) test = String(a_str=String(), a_int=Int())
@ -251,7 +238,6 @@ def test_query_arguments():
def test_query_input_field(): def test_query_input_field():
class Input(InputObjectType): class Input(InputObjectType):
a_field = String() a_field = String()
recursive_field = InputField(lambda: Input) recursive_field = InputField(lambda: Input)
@ -282,7 +268,6 @@ def test_query_input_field():
def test_query_middlewares(): def test_query_middlewares():
class Query(ObjectType): class Query(ObjectType):
hello = String() hello = String()
other = String() other = String()
@ -307,9 +292,7 @@ def test_query_middlewares():
def test_objecttype_on_instances(): def test_objecttype_on_instances():
class Ship: class Ship:
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
@ -369,7 +352,6 @@ def test_big_list_query_compiled_query_benchmark(benchmark):
def test_big_list_of_containers_query_benchmark(benchmark): def test_big_list_of_containers_query_benchmark(benchmark):
class Container(ObjectType): class Container(ObjectType):
x = Int() x = Int()
@ -390,7 +372,6 @@ def test_big_list_of_containers_query_benchmark(benchmark):
def test_big_list_of_containers_multiple_fields_query_benchmark(benchmark): def test_big_list_of_containers_multiple_fields_query_benchmark(benchmark):
class Container(ObjectType): class Container(ObjectType):
x = Int() x = Int()
y = Int() y = Int()
@ -420,7 +401,6 @@ def test_big_list_of_containers_multiple_fields_query_benchmark(benchmark):
def test_big_list_of_containers_multiple_fields_custom_resolvers_query_benchmark( def test_big_list_of_containers_multiple_fields_custom_resolvers_query_benchmark(
benchmark benchmark
): ):
class Container(ObjectType): class Container(ObjectType):
x = Int() x = Int()
y = Int() y = Int()

View File

@ -3,7 +3,6 @@ from ..scalars import Scalar
def test_scalar(): def test_scalar():
class JSONScalar(Scalar): class JSONScalar(Scalar):
"""Documentation""" """Documentation"""

View File

@ -24,9 +24,9 @@ from ..typemap import TypeMap, resolve_type
def test_enum(): def test_enum():
class MyEnum(Enum): class MyEnum(Enum):
"""Description""" """Description"""
foo = 1 foo = 1
bar = 2 bar = 2
@ -58,9 +58,9 @@ def test_enum():
def test_objecttype(): def test_objecttype():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
"""Description""" """Description"""
foo = String( foo = String(
bar=String(description="Argument description", default_value="x"), bar=String(description="Argument description", default_value="x"),
description="Field description", description="Field description",
@ -94,9 +94,9 @@ def test_objecttype():
def test_dynamic_objecttype(): def test_dynamic_objecttype():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
"""Description""" """Description"""
bar = Dynamic(lambda: Field(String)) bar = Dynamic(lambda: Field(String))
own = Field(lambda: MyObjectType) own = Field(lambda: MyObjectType)
@ -112,9 +112,9 @@ def test_dynamic_objecttype():
def test_interface(): def test_interface():
class MyInterface(Interface): class MyInterface(Interface):
"""Description""" """Description"""
foo = String( foo = String(
bar=String(description="Argument description", default_value="x"), bar=String(description="Argument description", default_value="x"),
description="Field description", description="Field description",
@ -151,7 +151,6 @@ def test_interface():
def test_inputobject(): def test_inputobject():
class OtherObjectType(InputObjectType): class OtherObjectType(InputObjectType):
thingy = NonNull(Int) thingy = NonNull(Int)
@ -161,6 +160,7 @@ def test_inputobject():
class MyInputObjectType(InputObjectType): class MyInputObjectType(InputObjectType):
"""Description""" """Description"""
foo_bar = String(description="Field description") foo_bar = String(description="Field description")
bar = String(name="gizmo") bar = String(name="gizmo")
baz = NonNull(MyInnerObjectType) baz = NonNull(MyInnerObjectType)
@ -210,9 +210,9 @@ def test_inputobject():
def test_objecttype_camelcase(): def test_objecttype_camelcase():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
"""Description""" """Description"""
foo_bar = String(bar_foo=String()) foo_bar = String(bar_foo=String())
typemap = TypeMap([MyObjectType]) typemap = TypeMap([MyObjectType])
@ -232,9 +232,9 @@ def test_objecttype_camelcase():
def test_objecttype_camelcase_disabled(): def test_objecttype_camelcase_disabled():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
"""Description""" """Description"""
foo_bar = String(bar_foo=String()) foo_bar = String(bar_foo=String())
typemap = TypeMap([MyObjectType], auto_camelcase=False) typemap = TypeMap([MyObjectType], auto_camelcase=False)
@ -254,7 +254,6 @@ def test_objecttype_camelcase_disabled():
def test_objecttype_with_possible_types(): def test_objecttype_with_possible_types():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
"""Description""" """Description"""
@ -271,7 +270,6 @@ def test_objecttype_with_possible_types():
def test_resolve_type_with_missing_type(): def test_resolve_type_with_missing_type():
class MyObjectType(ObjectType): class MyObjectType(ObjectType):
foo_bar = String() foo_bar = String()

View File

@ -15,7 +15,6 @@ class MyObjectType2(ObjectType):
def test_generate_union(): def test_generate_union():
class MyUnion(Union): class MyUnion(Union):
"""Documentation""" """Documentation"""
@ -28,9 +27,7 @@ def test_generate_union():
def test_generate_union_with_meta(): def test_generate_union_with_meta():
class MyUnion(Union): class MyUnion(Union):
class Meta: class Meta:
name = "MyOtherUnion" name = "MyOtherUnion"
description = "Documentation" description = "Documentation"
@ -50,9 +47,7 @@ def test_generate_union_with_no_types():
def test_union_can_be_mounted(): def test_union_can_be_mounted():
class MyUnion(Union): class MyUnion(Union):
class Meta: class Meta:
types = (MyObjectType1, MyObjectType2) types = (MyObjectType1, MyObjectType2)

View File

@ -74,7 +74,6 @@ def is_type_of_from_possible_types(possible_types, root, info):
class TypeMap(GraphQLTypeMap): class TypeMap(GraphQLTypeMap):
def __init__(self, types, auto_camelcase=True, schema=None): def __init__(self, types, auto_camelcase=True, schema=None):
self.auto_camelcase = auto_camelcase self.auto_camelcase = auto_camelcase
self.schema = schema self.schema = schema

View File

@ -5,7 +5,6 @@ from .deprecated import deprecated
@deprecated("This function is deprecated") @deprecated("This function is deprecated")
def resolve_only_args(func): def resolve_only_args(func):
@wraps(func) @wraps(func)
def wrapped_func(root, info, **args): def wrapped_func(root, info, **args):
return func(root, **args) return func(root, **args)

View File

@ -20,6 +20,7 @@ class SubclassWithMeta_Meta(InitSubclassMeta):
class SubclassWithMeta(six.with_metaclass(SubclassWithMeta_Meta)): class SubclassWithMeta(six.with_metaclass(SubclassWithMeta_Meta)):
"""This class improves __init_subclass__ to receive automatically the options from meta""" """This class improves __init_subclass__ to receive automatically the options from meta"""
# We will only have the metaclass in Python 2 # We will only have the metaclass in Python 2
def __init_subclass__(cls, **meta_options): def __init_subclass__(cls, **meta_options):
"""This method just terminates the super() chain""" """This method just terminates the super() chain"""

View File

@ -106,9 +106,7 @@ TEST_DATA = {
def test_example_end_to_end(): def test_example_end_to_end():
class Movie(graphene.ObjectType): class Movie(graphene.ObjectType):
class Meta: class Meta:
interfaces = (relay.Node,) interfaces = (relay.Node,)
default_resolver = dict_resolver default_resolver = dict_resolver
@ -117,7 +115,6 @@ def test_example_end_to_end():
synopsis = graphene.String(required=True) synopsis = graphene.String(required=True)
class Event(graphene.ObjectType): class Event(graphene.ObjectType):
class Meta: class Meta:
interfaces = (relay.Node,) interfaces = (relay.Node,)
default_resolver = dict_resolver default_resolver = dict_resolver

View File

@ -2,7 +2,6 @@ from ..trim_docstring import trim_docstring
def test_trim_docstring(): def test_trim_docstring():
class WellDocumentedObject(object): class WellDocumentedObject(object):
""" """
This object is very well-documented. It has multiple lines in its This object is very well-documented. It has multiple lines in its