mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-11-04 09:57:41 +03:00 
			
		
		
		
	Run black formatter via pre-commit on all files
This commit is contained in:
		
							parent
							
								
									086f9dda99
								
							
						
					
					
						commit
						142f4a58d8
					
				| 
						 | 
				
			
			@ -14,11 +14,11 @@ repos:
 | 
			
		|||
        - --autofix
 | 
			
		||||
    -   id: flake8
 | 
			
		||||
-   repo: https://github.com/asottile/pyupgrade
 | 
			
		||||
    rev: v1.2.0
 | 
			
		||||
    rev: v1.4.0
 | 
			
		||||
    hooks:
 | 
			
		||||
    -   id: pyupgrade
 | 
			
		||||
-   repo: https://github.com/ambv/black
 | 
			
		||||
    rev: stable
 | 
			
		||||
    rev: 18.6b4
 | 
			
		||||
    hooks:
 | 
			
		||||
    - id: black
 | 
			
		||||
      language_version: python3.6
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,6 @@ class Query(graphene.ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class CreateAddress(graphene.Mutation):
 | 
			
		||||
 | 
			
		||||
    class Arguments:
 | 
			
		||||
        geo = GeoInput(required=True)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,6 @@ class Character(graphene.Interface):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Human(graphene.ObjectType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        interfaces = (Character,)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +28,6 @@ class Human(graphene.ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Droid(graphene.ObjectType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        interfaces = (Character,)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,6 @@ class Ship(graphene.ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class ShipConnection(relay.Connection):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        node = Ship
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +43,6 @@ class Faction(graphene.ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class IntroduceShip(relay.ClientIDMutation):
 | 
			
		||||
 | 
			
		||||
    class Input:
 | 
			
		||||
        ship_name = graphene.String(required=True)
 | 
			
		||||
        faction_id = graphene.String(required=True)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -208,7 +208,7 @@ class EnumMeta(type):
 | 
			
		|||
        invalid_names = set(members) & {"mro"}
 | 
			
		||||
        if invalid_names:
 | 
			
		||||
            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
 | 
			
		||||
| 
						 | 
				
			
			@ -682,7 +682,7 @@ def __new__(cls, value):
 | 
			
		|||
        for member in cls._member_map_.values():
 | 
			
		||||
            if member.value == value:
 | 
			
		||||
                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__
 | 
			
		||||
| 
						 | 
				
			
			@ -690,7 +690,7 @@ del __new__
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
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__
 | 
			
		||||
| 
						 | 
				
			
			@ -698,7 +698,7 @@ del __repr__
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def __str__(self):
 | 
			
		||||
    return "%s.%s" % (self.__class__.__name__, self._name_)
 | 
			
		||||
    return "{}.{}".format(self.__class__.__name__, self._name_)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
temp_enum_dict["__str__"] = __str__
 | 
			
		||||
| 
						 | 
				
			
			@ -907,9 +907,9 @@ def unique(enumeration):
 | 
			
		|||
            duplicates.append((name, member.name))
 | 
			
		||||
    if duplicates:
 | 
			
		||||
        duplicate_names = ", ".join(
 | 
			
		||||
            ["%s -> %s" % (alias, name) for (alias, name) in duplicates]
 | 
			
		||||
            ["{} -> {}".format(alias, name) for (alias, name) in duplicates]
 | 
			
		||||
        )
 | 
			
		||||
        raise ValueError(
 | 
			
		||||
            "duplicate names found in %r: %s" % (enumeration, duplicate_names)
 | 
			
		||||
            "duplicate names found in {!r}: {}".format(enumeration, duplicate_names)
 | 
			
		||||
        )
 | 
			
		||||
    return enumeration
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -186,7 +186,6 @@ class _empty(object):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class _ParameterKind(int):
 | 
			
		||||
 | 
			
		||||
    def __new__(self, *args, **kwargs):
 | 
			
		||||
        obj = int.__new__(self, *args)
 | 
			
		||||
        obj._name = kwargs["name"]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,6 @@ class ConnectionOptions(ObjectTypeOptions):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Connection(ObjectType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        abstract = True
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +87,6 @@ class Connection(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class IterableConnectionField(Field):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, type, *args, **kwargs):
 | 
			
		||||
        kwargs.setdefault("before", String())
 | 
			
		||||
        kwargs.setdefault("after", String())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,6 @@ from ..types.mutation import Mutation
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class ClientIDMutation(Mutation):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        abstract = True
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -58,7 +57,6 @@ class ClientIDMutation(Mutation):
 | 
			
		|||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def mutate(cls, root, info, input):
 | 
			
		||||
 | 
			
		||||
        def on_resolve(payload):
 | 
			
		||||
            try:
 | 
			
		||||
                payload.client_mutation_id = input.get("client_mutation_id")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,6 @@ def is_node(objecttype):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class GlobalID(Field):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, node=None, parent_type=None, required=True, *args, **kwargs):
 | 
			
		||||
        super(GlobalID, self).__init__(ID, required=required, *args, **kwargs)
 | 
			
		||||
        self.node = node or Node
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +48,6 @@ class GlobalID(Field):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class NodeField(Field):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, node, type=False, deprecation_reason=None, name=None, **kwargs):
 | 
			
		||||
        assert issubclass(node, Node), "NodeField can only operate in Nodes"
 | 
			
		||||
        self.node_type = node
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +66,6 @@ class NodeField(Field):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class AbstractNode(Interface):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        abstract = True
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,6 @@ from ..node import Node
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MyObject(ObjectType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        interfaces = [Node]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +13,6 @@ class MyObject(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_connection():
 | 
			
		||||
 | 
			
		||||
    class MyObjectConnection(Connection):
 | 
			
		||||
        extra = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -41,12 +39,10 @@ def test_connection():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_connection_inherit_abstracttype():
 | 
			
		||||
 | 
			
		||||
    class BaseConnection(object):
 | 
			
		||||
        extra = String()
 | 
			
		||||
 | 
			
		||||
    class MyObjectConnection(BaseConnection, Connection):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            node = MyObject
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -62,7 +58,6 @@ def test_connection_name():
 | 
			
		|||
        extra = String()
 | 
			
		||||
 | 
			
		||||
    class MyObjectConnection(BaseConnection, Connection):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            node = MyObject
 | 
			
		||||
            name = custom_name
 | 
			
		||||
| 
						 | 
				
			
			@ -71,9 +66,7 @@ def test_connection_name():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_edge():
 | 
			
		||||
 | 
			
		||||
    class MyObjectConnection(Connection):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            node = MyObject
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -93,12 +86,10 @@ def test_edge():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_edge_with_bases():
 | 
			
		||||
 | 
			
		||||
    class BaseEdge(object):
 | 
			
		||||
        extra = String()
 | 
			
		||||
 | 
			
		||||
    class MyObjectConnection(Connection):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            node = MyObject
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -129,9 +120,7 @@ def test_pageinfo():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_connectionfield():
 | 
			
		||||
 | 
			
		||||
    class MyObjectConnection(Connection):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            node = MyObject
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -155,9 +144,7 @@ def test_connectionfield_node_deprecated():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_connectionfield_custom_args():
 | 
			
		||||
 | 
			
		||||
    class MyObjectConnection(Connection):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            node = MyObject
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -174,9 +161,7 @@ def test_connectionfield_custom_args():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_connectionfield_required():
 | 
			
		||||
 | 
			
		||||
    class MyObjectConnection(Connection):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            node = MyObject
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,6 @@ letter_chars = ["A", "B", "C", "D", "E"]
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Letter(ObjectType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        interfaces = (Node,)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +18,6 @@ class Letter(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class LetterConnection(Connection):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        node = Letter
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,13 +6,11 @@ from ..node import GlobalID, Node
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class CustomNode(Node):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        name = "Node"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class User(ObjectType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        interfaces = [CustomNode]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -20,7 +18,6 @@ class User(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Info(object):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, parent_type):
 | 
			
		||||
        self.parent_type = GrapheneObjectType(
 | 
			
		||||
            graphene_type=parent_type,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,6 @@ class MyNode(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class SaySomething(ClientIDMutation):
 | 
			
		||||
 | 
			
		||||
    class Input:
 | 
			
		||||
        what = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +45,6 @@ class FixedSaySomething(object):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class SaySomethingFixed(ClientIDMutation):
 | 
			
		||||
 | 
			
		||||
    class Input:
 | 
			
		||||
        what = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -58,7 +56,6 @@ class SaySomethingFixed(ClientIDMutation):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class SaySomethingPromise(ClientIDMutation):
 | 
			
		||||
 | 
			
		||||
    class Input:
 | 
			
		||||
        what = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -76,7 +73,6 @@ class MyEdge(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class OtherMutation(ClientIDMutation):
 | 
			
		||||
 | 
			
		||||
    class Input(SharedFields):
 | 
			
		||||
        additional_field = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,6 @@ class SharedNodeFields(object):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MyNode(ObjectType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        interfaces = (Node,)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,6 @@ from ..node import Node
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class CustomNode(Node):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        name = "Node"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +27,6 @@ class BasePhoto(Interface):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class User(ObjectType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        interfaces = [CustomNode]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +34,6 @@ class User(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Photo(ObjectType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        interfaces = [CustomNode, BasePhoto]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,7 +27,6 @@ def format_execution_result(execution_result, format_error):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Client(object):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, schema, format_error=None, **execute_options):
 | 
			
		||||
        assert isinstance(schema, Schema)
 | 
			
		||||
        self.schema = schema
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,13 +16,11 @@ class Error(graphene.ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class CreatePostResult(graphene.Union):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        types = [Success, Error]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class CreatePost(graphene.Mutation):
 | 
			
		||||
 | 
			
		||||
    class Input:
 | 
			
		||||
        text = graphene.String(required=True)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,13 +15,11 @@ class SomeTypeTwo(graphene.ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MyUnion(graphene.Union):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        types = (SomeTypeOne, SomeTypeTwo)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_issue():
 | 
			
		||||
 | 
			
		||||
    class Query(graphene.ObjectType):
 | 
			
		||||
        things = relay.ConnectionField(MyUnion)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,6 @@ class SpecialOptions(ObjectTypeOptions):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class SpecialObjectType(ObjectType):
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def __init_subclass_with_meta__(cls, other_attr="default", **options):
 | 
			
		||||
        _meta = SpecialOptions(cls)
 | 
			
		||||
| 
						 | 
				
			
			@ -23,9 +22,7 @@ class SpecialObjectType(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_special_objecttype_could_be_subclassed():
 | 
			
		||||
 | 
			
		||||
    class MyType(SpecialObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            other_attr = "yeah!"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +30,6 @@ def test_special_objecttype_could_be_subclassed():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_special_objecttype_could_be_subclassed_default():
 | 
			
		||||
 | 
			
		||||
    class MyType(SpecialObjectType):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -41,7 +37,6 @@ def test_special_objecttype_could_be_subclassed_default():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_special_objecttype_inherit_meta_options():
 | 
			
		||||
 | 
			
		||||
    class MyType(SpecialObjectType):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -56,7 +51,6 @@ class SpecialInputObjectTypeOptions(ObjectTypeOptions):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class SpecialInputObjectType(InputObjectType):
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def __init_subclass_with_meta__(cls, other_attr="default", **options):
 | 
			
		||||
        _meta = SpecialInputObjectTypeOptions(cls)
 | 
			
		||||
| 
						 | 
				
			
			@ -67,9 +61,7 @@ class SpecialInputObjectType(InputObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_special_inputobjecttype_could_be_subclassed():
 | 
			
		||||
 | 
			
		||||
    class MyInputObjectType(SpecialInputObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            other_attr = "yeah!"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -77,7 +69,6 @@ def test_special_inputobjecttype_could_be_subclassed():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_special_inputobjecttype_could_be_subclassed_default():
 | 
			
		||||
 | 
			
		||||
    class MyInputObjectType(SpecialInputObjectType):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -85,7 +76,6 @@ def test_special_inputobjecttype_could_be_subclassed_default():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_special_inputobjecttype_inherit_meta_options():
 | 
			
		||||
 | 
			
		||||
    class MyInputObjectType(SpecialInputObjectType):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -98,7 +88,6 @@ class SpecialEnumOptions(EnumOptions):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class SpecialEnum(Enum):
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def __init_subclass_with_meta__(cls, other_attr="default", **options):
 | 
			
		||||
        _meta = SpecialEnumOptions(cls)
 | 
			
		||||
| 
						 | 
				
			
			@ -107,9 +96,7 @@ class SpecialEnum(Enum):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_special_enum_could_be_subclassed():
 | 
			
		||||
 | 
			
		||||
    class MyEnum(SpecialEnum):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            other_attr = "yeah!"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -117,7 +104,6 @@ def test_special_enum_could_be_subclassed():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_special_enum_could_be_subclassed_default():
 | 
			
		||||
 | 
			
		||||
    class MyEnum(SpecialEnum):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -125,7 +111,6 @@ def test_special_enum_could_be_subclassed_default():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_special_enum_inherit_meta_options():
 | 
			
		||||
 | 
			
		||||
    class MyEnum(SpecialEnum):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,6 @@ import graphene
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MyInputClass(graphene.InputObjectType):
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def __init_subclass_with_meta__(
 | 
			
		||||
        cls, container=None, _meta=None, fields=None, **options
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +20,6 @@ class MyInputClass(graphene.InputObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MyInput(MyInputClass):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        fields = dict(x=graphene.Field(graphene.Int))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@ from ..utils.subclass_with_meta import SubclassWithMeta
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class AbstractType(SubclassWithMeta):
 | 
			
		||||
 | 
			
		||||
    def __init_subclass__(cls, *args, **kwargs):
 | 
			
		||||
        warn_deprecation(
 | 
			
		||||
            "Abstract type is deprecated, please use normal object inheritance instead.\n"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,6 @@ from .utils import get_type
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Argument(MountedType):
 | 
			
		||||
 | 
			
		||||
    def __init__(
 | 
			
		||||
        self,
 | 
			
		||||
        type,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,6 @@ class BaseOptions(object):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class BaseType(SubclassWithMeta):
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def create_type(cls, class_name, **options):
 | 
			
		||||
        return type(class_name, (cls,), {"Meta": options})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
class Context(object):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, **params):
 | 
			
		||||
        for key, value in params.items():
 | 
			
		||||
            setattr(self, key, value)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,7 +24,6 @@ class EnumOptions(BaseOptions):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class EnumMeta(SubclassWithMeta_Meta):
 | 
			
		||||
 | 
			
		||||
    def __new__(cls, name, bases, classdict, **options):
 | 
			
		||||
        enum_members = OrderedDict(classdict, __eq__=eq_enum)
 | 
			
		||||
        # 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)):
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def __init_subclass_with_meta__(cls, enum=None, _meta=None, **options):
 | 
			
		||||
        if not _meta:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,6 @@ def source_resolver(source, root, info, **args):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class Field(MountedType):
 | 
			
		||||
 | 
			
		||||
    def __init__(
 | 
			
		||||
        self,
 | 
			
		||||
        type,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,6 @@ from .utils import get_type
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class InputField(MountedType):
 | 
			
		||||
 | 
			
		||||
    def __init__(
 | 
			
		||||
        self,
 | 
			
		||||
        type,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ class InputObjectTypeOptions(BaseOptions):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class InputObjectTypeContainer(dict, BaseType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        abstract = True
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@ from .unmountedtype import UnmountedType
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MountedType(OrderedType):
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def mounted(cls, unmounted):  # noqa: N802
 | 
			
		||||
        """
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,6 @@ class MyType(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MyScalar(UnmountedType):
 | 
			
		||||
 | 
			
		||||
    def get_type(self):
 | 
			
		||||
        return MyType
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +24,6 @@ def test_abstract_objecttype_warn_deprecation(mocker):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_objecttype_inherit_abstracttype():
 | 
			
		||||
 | 
			
		||||
    class MyAbstractType(AbstractType):
 | 
			
		||||
        field1 = MyScalar()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,6 @@ class CustomOptions(BaseOptions):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class CustomType(BaseType):
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def __init_subclass_with_meta__(cls, **options):
 | 
			
		||||
        _meta = CustomOptions(cls)
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +13,6 @@ class CustomType(BaseType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_basetype():
 | 
			
		||||
 | 
			
		||||
    class MyBaseType(CustomType):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -24,7 +22,6 @@ def test_basetype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_basetype_nones():
 | 
			
		||||
 | 
			
		||||
    class MyBaseType(CustomType):
 | 
			
		||||
        """Documentation"""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +35,6 @@ def test_basetype_nones():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_basetype_custom():
 | 
			
		||||
 | 
			
		||||
    class MyBaseType(CustomType):
 | 
			
		||||
        """Documentation"""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,7 +56,6 @@ class MyInterface(Interface):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MyUnion(Union):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        types = (Article,)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -116,7 +115,6 @@ def test_defines_a_subscription_schema():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_includes_nested_input_objects_in_the_map():
 | 
			
		||||
 | 
			
		||||
    class NestedInputObject(InputObjectType):
 | 
			
		||||
        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():
 | 
			
		||||
 | 
			
		||||
    class SomeInterface(Interface):
 | 
			
		||||
        f = Int()
 | 
			
		||||
 | 
			
		||||
    class SomeSubtype(ObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            interfaces = (SomeInterface,)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -153,7 +149,6 @@ def test_includes_interfaces_thunk_subtypes_in_the_type_map():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_includes_types_in_union():
 | 
			
		||||
 | 
			
		||||
    class SomeType(ObjectType):
 | 
			
		||||
        a = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -161,7 +156,6 @@ def test_includes_types_in_union():
 | 
			
		|||
        b = String()
 | 
			
		||||
 | 
			
		||||
    class MyUnion(Union):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            types = (SomeType, OtherType)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -175,7 +169,6 @@ def test_includes_types_in_union():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_maps_enum():
 | 
			
		||||
 | 
			
		||||
    class SomeType(ObjectType):
 | 
			
		||||
        a = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -183,7 +176,6 @@ def test_maps_enum():
 | 
			
		|||
        b = String()
 | 
			
		||||
 | 
			
		||||
    class MyUnion(Union):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            types = (SomeType, OtherType)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -197,12 +189,10 @@ def test_maps_enum():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_includes_interfaces_subtypes_in_the_type_map():
 | 
			
		||||
 | 
			
		||||
    class SomeInterface(Interface):
 | 
			
		||||
        f = Int()
 | 
			
		||||
 | 
			
		||||
    class SomeSubtype(ObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            interfaces = (SomeInterface,)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -293,7 +283,6 @@ def test_stringifies_simple_types():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_does_not_mutate_passed_field_definitions():
 | 
			
		||||
 | 
			
		||||
    class CommonFields(object):
 | 
			
		||||
        field1 = String()
 | 
			
		||||
        field2 = String(id=String())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,7 +30,6 @@ def test_list_non_null():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_partial():
 | 
			
		||||
 | 
			
		||||
    def __type(_type):
 | 
			
		||||
        return _type
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,9 +8,9 @@ from ..schema import ObjectType, Schema
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_construction():
 | 
			
		||||
 | 
			
		||||
    class RGB(Enum):
 | 
			
		||||
        """Description"""
 | 
			
		||||
 | 
			
		||||
        RED = 1
 | 
			
		||||
        GREEN = 2
 | 
			
		||||
        BLUE = 3
 | 
			
		||||
| 
						 | 
				
			
			@ -32,9 +32,7 @@ def test_enum_construction():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_construction_meta():
 | 
			
		||||
 | 
			
		||||
    class RGB(Enum):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            name = "RGBEnum"
 | 
			
		||||
            description = "Description"
 | 
			
		||||
| 
						 | 
				
			
			@ -65,7 +63,6 @@ def test_enum_from_builtin_enum():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_from_builtin_enum_accepts_lambda_description():
 | 
			
		||||
 | 
			
		||||
    def custom_description(value):
 | 
			
		||||
        if not value:
 | 
			
		||||
            return "StarWars Episodes"
 | 
			
		||||
| 
						 | 
				
			
			@ -125,6 +122,7 @@ def test_enum_from_python3_enum_uses_enum_doc():
 | 
			
		|||
 | 
			
		||||
    class Color(PyEnum):
 | 
			
		||||
        """This is the description"""
 | 
			
		||||
 | 
			
		||||
        RED = 1
 | 
			
		||||
        GREEN = 2
 | 
			
		||||
        BLUE = 3
 | 
			
		||||
| 
						 | 
				
			
			@ -139,7 +137,6 @@ def test_enum_from_python3_enum_uses_enum_doc():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_value_from_class():
 | 
			
		||||
 | 
			
		||||
    class RGB(Enum):
 | 
			
		||||
        RED = 1
 | 
			
		||||
        GREEN = 2
 | 
			
		||||
| 
						 | 
				
			
			@ -151,7 +148,6 @@ def test_enum_value_from_class():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_value_as_unmounted_field():
 | 
			
		||||
 | 
			
		||||
    class RGB(Enum):
 | 
			
		||||
        RED = 1
 | 
			
		||||
        GREEN = 2
 | 
			
		||||
| 
						 | 
				
			
			@ -164,7 +160,6 @@ def test_enum_value_as_unmounted_field():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_value_as_unmounted_inputfield():
 | 
			
		||||
 | 
			
		||||
    class RGB(Enum):
 | 
			
		||||
        RED = 1
 | 
			
		||||
        GREEN = 2
 | 
			
		||||
| 
						 | 
				
			
			@ -177,7 +172,6 @@ def test_enum_value_as_unmounted_inputfield():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_value_as_unmounted_argument():
 | 
			
		||||
 | 
			
		||||
    class RGB(Enum):
 | 
			
		||||
        RED = 1
 | 
			
		||||
        GREEN = 2
 | 
			
		||||
| 
						 | 
				
			
			@ -190,7 +184,6 @@ def test_enum_value_as_unmounted_argument():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_can_be_compared():
 | 
			
		||||
 | 
			
		||||
    class RGB(Enum):
 | 
			
		||||
        RED = 1
 | 
			
		||||
        GREEN = 2
 | 
			
		||||
| 
						 | 
				
			
			@ -202,7 +195,6 @@ def test_enum_can_be_compared():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_can_be_initialzied():
 | 
			
		||||
 | 
			
		||||
    class RGB(Enum):
 | 
			
		||||
        RED = 1
 | 
			
		||||
        GREEN = 2
 | 
			
		||||
| 
						 | 
				
			
			@ -214,7 +206,6 @@ def test_enum_can_be_initialzied():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_can_retrieve_members():
 | 
			
		||||
 | 
			
		||||
    class RGB(Enum):
 | 
			
		||||
        RED = 1
 | 
			
		||||
        GREEN = 2
 | 
			
		||||
| 
						 | 
				
			
			@ -226,7 +217,6 @@ def test_enum_can_retrieve_members():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_to_enum_comparison_should_differ():
 | 
			
		||||
 | 
			
		||||
    class RGB1(Enum):
 | 
			
		||||
        RED = 1
 | 
			
		||||
        GREEN = 2
 | 
			
		||||
| 
						 | 
				
			
			@ -243,9 +233,7 @@ def test_enum_to_enum_comparison_should_differ():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum_skip_meta_from_members():
 | 
			
		||||
 | 
			
		||||
    class RGB1(Enum):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            name = "RGB"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,13 +14,11 @@ class MyType(object):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MyScalar(UnmountedType):
 | 
			
		||||
 | 
			
		||||
    def get_type(self):
 | 
			
		||||
        return MyType
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_generate_inputobjecttype():
 | 
			
		||||
 | 
			
		||||
    class MyInputObjectType(InputObjectType):
 | 
			
		||||
        """Documentation"""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -30,9 +28,7 @@ def test_generate_inputobjecttype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_inputobjecttype_with_meta():
 | 
			
		||||
 | 
			
		||||
    class MyInputObjectType(InputObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            name = "MyOtherInputObjectType"
 | 
			
		||||
            description = "Documentation"
 | 
			
		||||
| 
						 | 
				
			
			@ -42,7 +38,6 @@ def test_generate_inputobjecttype_with_meta():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_inputobjecttype_with_fields():
 | 
			
		||||
 | 
			
		||||
    class MyInputObjectType(InputObjectType):
 | 
			
		||||
        field = Field(MyType)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -50,7 +45,6 @@ def test_generate_inputobjecttype_with_fields():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_ordered_fields_in_inputobjecttype():
 | 
			
		||||
 | 
			
		||||
    class MyInputObjectType(InputObjectType):
 | 
			
		||||
        b = InputField(MyType)
 | 
			
		||||
        a = InputField(MyType)
 | 
			
		||||
| 
						 | 
				
			
			@ -61,7 +55,6 @@ def test_ordered_fields_in_inputobjecttype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_inputobjecttype_unmountedtype():
 | 
			
		||||
 | 
			
		||||
    class MyInputObjectType(InputObjectType):
 | 
			
		||||
        field = MyScalar(MyType)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -70,7 +63,6 @@ def test_generate_inputobjecttype_unmountedtype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_inputobjecttype_as_argument():
 | 
			
		||||
 | 
			
		||||
    class MyInputObjectType(InputObjectType):
 | 
			
		||||
        field = MyScalar()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +79,6 @@ def test_generate_inputobjecttype_as_argument():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_inputobjecttype_inherit_abstracttype():
 | 
			
		||||
 | 
			
		||||
    class MyAbstractType(object):
 | 
			
		||||
        field1 = MyScalar(MyType)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -102,7 +93,6 @@ def test_generate_inputobjecttype_inherit_abstracttype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_inputobjecttype_inherit_abstracttype_reversed():
 | 
			
		||||
 | 
			
		||||
    class MyAbstractType(object):
 | 
			
		||||
        field1 = MyScalar(MyType)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -117,7 +107,6 @@ def test_generate_inputobjecttype_inherit_abstracttype_reversed():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_inputobjecttype_of_input():
 | 
			
		||||
 | 
			
		||||
    class Child(InputObjectType):
 | 
			
		||||
        first_name = String()
 | 
			
		||||
        last_name = String()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,13 +8,11 @@ class MyType(object):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MyScalar(UnmountedType):
 | 
			
		||||
 | 
			
		||||
    def get_type(self):
 | 
			
		||||
        return MyType
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_generate_interface():
 | 
			
		||||
 | 
			
		||||
    class MyInterface(Interface):
 | 
			
		||||
        """Documentation"""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -24,9 +22,7 @@ def test_generate_interface():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_interface_with_meta():
 | 
			
		||||
 | 
			
		||||
    class MyInterface(Interface):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            name = "MyOtherInterface"
 | 
			
		||||
            description = "Documentation"
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +32,6 @@ def test_generate_interface_with_meta():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_interface_with_fields():
 | 
			
		||||
 | 
			
		||||
    class MyInterface(Interface):
 | 
			
		||||
        field = Field(MyType)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +39,6 @@ def test_generate_interface_with_fields():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_ordered_fields_in_interface():
 | 
			
		||||
 | 
			
		||||
    class MyInterface(Interface):
 | 
			
		||||
        b = Field(MyType)
 | 
			
		||||
        a = Field(MyType)
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +49,6 @@ def test_ordered_fields_in_interface():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_interface_unmountedtype():
 | 
			
		||||
 | 
			
		||||
    class MyInterface(Interface):
 | 
			
		||||
        field = MyScalar()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -64,7 +57,6 @@ def test_generate_interface_unmountedtype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_interface_inherit_abstracttype():
 | 
			
		||||
 | 
			
		||||
    class MyAbstractType(object):
 | 
			
		||||
        field1 = MyScalar()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -76,7 +68,6 @@ def test_generate_interface_inherit_abstracttype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_interface_inherit_interface():
 | 
			
		||||
 | 
			
		||||
    class MyBaseInterface(Interface):
 | 
			
		||||
        field1 = MyScalar()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +80,6 @@ def test_generate_interface_inherit_interface():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_interface_inherit_abstracttype_reversed():
 | 
			
		||||
 | 
			
		||||
    class MyAbstractType(object):
 | 
			
		||||
        field1 = MyScalar()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,6 @@ from ..scalars import String
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class CustomField(Field):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, *args, **kwargs):
 | 
			
		||||
        self.metadata = kwargs.pop("metadata", None)
 | 
			
		||||
        super(CustomField, self).__init__(*args, **kwargs)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,6 @@ from ..structures import NonNull
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_mutation_no_args():
 | 
			
		||||
 | 
			
		||||
    class MyMutation(Mutation):
 | 
			
		||||
        """Documentation"""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -25,9 +24,7 @@ def test_generate_mutation_no_args():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_mutation_with_meta():
 | 
			
		||||
 | 
			
		||||
    class MyMutation(Mutation):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            name = "MyOtherMutation"
 | 
			
		||||
            description = "Documentation"
 | 
			
		||||
| 
						 | 
				
			
			@ -51,12 +48,10 @@ def test_mutation_raises_exception_if_no_mutate():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_mutation_custom_output_type():
 | 
			
		||||
 | 
			
		||||
    class User(ObjectType):
 | 
			
		||||
        name = String()
 | 
			
		||||
 | 
			
		||||
    class CreateUser(Mutation):
 | 
			
		||||
 | 
			
		||||
        class Arguments:
 | 
			
		||||
            name = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -74,9 +69,7 @@ def test_mutation_custom_output_type():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_mutation_execution():
 | 
			
		||||
 | 
			
		||||
    class CreateUser(Mutation):
 | 
			
		||||
 | 
			
		||||
        class Arguments:
 | 
			
		||||
            name = String()
 | 
			
		||||
            dynamic = Dynamic(lambda: String())
 | 
			
		||||
| 
						 | 
				
			
			@ -109,7 +102,6 @@ def test_mutation_execution():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_mutation_no_fields_output():
 | 
			
		||||
 | 
			
		||||
    class CreateUser(Mutation):
 | 
			
		||||
        name = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -136,9 +128,7 @@ def test_mutation_no_fields_output():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_mutation_allow_to_have_custom_args():
 | 
			
		||||
 | 
			
		||||
    class CreateUser(Mutation):
 | 
			
		||||
 | 
			
		||||
        class Arguments:
 | 
			
		||||
            name = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,6 @@ class MyInterface(Interface):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class ContainerWithInterface(ObjectType):
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        interfaces = (MyInterface,)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -32,13 +31,11 @@ class ContainerWithInterface(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class MyScalar(UnmountedType):
 | 
			
		||||
 | 
			
		||||
    def get_type(self):
 | 
			
		||||
        return MyType
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_generate_objecttype():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        """Documentation"""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -53,9 +50,7 @@ def test_generate_objecttype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_objecttype_with_meta():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            name = "MyOtherObjectType"
 | 
			
		||||
            description = "Documentation"
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +62,6 @@ def test_generate_objecttype_with_meta():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_lazy_objecttype():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        example = Field(lambda: InnerObjectType, required=True)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +75,6 @@ def test_generate_lazy_objecttype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_objecttype_with_fields():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        field = Field(MyType)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +82,6 @@ def test_generate_objecttype_with_fields():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_objecttype_with_private_attributes():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        _private_state = None
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +96,6 @@ def test_generate_objecttype_with_private_attributes():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_ordered_fields_in_objecttype():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        b = Field(MyType)
 | 
			
		||||
        a = Field(MyType)
 | 
			
		||||
| 
						 | 
				
			
			@ -115,7 +106,6 @@ def test_ordered_fields_in_objecttype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_objecttype_inherit_abstracttype():
 | 
			
		||||
 | 
			
		||||
    class MyAbstractType(object):
 | 
			
		||||
        field1 = MyScalar()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -130,7 +120,6 @@ def test_generate_objecttype_inherit_abstracttype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_objecttype_inherit_abstracttype_reversed():
 | 
			
		||||
 | 
			
		||||
    class MyAbstractType(object):
 | 
			
		||||
        field1 = MyScalar()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -145,7 +134,6 @@ def test_generate_objecttype_inherit_abstracttype_reversed():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_objecttype_unmountedtype():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        field = MyScalar()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -205,14 +193,12 @@ def test_objecttype_as_container_invalid_kwargs():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_objecttype_container_benchmark(benchmark):
 | 
			
		||||
 | 
			
		||||
    @benchmark
 | 
			
		||||
    def create_objecttype():
 | 
			
		||||
        Container(field1="field1", field2="field2")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_generate_objecttype_description():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        """
 | 
			
		||||
        Documentation
 | 
			
		||||
| 
						 | 
				
			
			@ -224,9 +210,7 @@ def test_generate_objecttype_description():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_objecttype_with_possible_types():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            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:
 | 
			
		||||
 | 
			
		||||
        class MyObjectType(ObjectType):
 | 
			
		||||
 | 
			
		||||
            class Meta:
 | 
			
		||||
                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():
 | 
			
		||||
 | 
			
		||||
    class User(ObjectType):
 | 
			
		||||
        name = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -276,9 +258,7 @@ def test_objecttype_no_fields_output():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_abstract_objecttype_can_str():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            abstract = True
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ from ..union import Union
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query():
 | 
			
		||||
 | 
			
		||||
    class Query(ObjectType):
 | 
			
		||||
        hello = String(resolver=lambda *_: "World")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +28,6 @@ def test_query():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_source():
 | 
			
		||||
 | 
			
		||||
    class Root(object):
 | 
			
		||||
        _hello = "World"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +45,6 @@ def test_query_source():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_union():
 | 
			
		||||
 | 
			
		||||
    class one_object(object):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -69,7 +66,6 @@ def test_query_union():
 | 
			
		|||
            return isinstance(root, two_object)
 | 
			
		||||
 | 
			
		||||
    class MyUnion(Union):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            types = (One, Two)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +83,6 @@ def test_query_union():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_interface():
 | 
			
		||||
 | 
			
		||||
    class one_object(object):
 | 
			
		||||
        pass
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -98,7 +93,6 @@ def test_query_interface():
 | 
			
		|||
        base = String()
 | 
			
		||||
 | 
			
		||||
    class One(ObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            interfaces = (MyInterface,)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -109,7 +103,6 @@ def test_query_interface():
 | 
			
		|||
            return isinstance(root, one_object)
 | 
			
		||||
 | 
			
		||||
    class Two(ObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            interfaces = (MyInterface,)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -135,7 +128,6 @@ def test_query_interface():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_dynamic():
 | 
			
		||||
 | 
			
		||||
    class Query(ObjectType):
 | 
			
		||||
        hello = Dynamic(lambda: String(resolver=lambda *_: "World"))
 | 
			
		||||
        hellos = Dynamic(lambda: List(String, resolver=lambda *_: ["Worlds"]))
 | 
			
		||||
| 
						 | 
				
			
			@ -153,7 +145,6 @@ def test_query_dynamic():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_default_value():
 | 
			
		||||
 | 
			
		||||
    class MyType(ObjectType):
 | 
			
		||||
        field = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -168,7 +159,6 @@ def test_query_default_value():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_wrong_default_value():
 | 
			
		||||
 | 
			
		||||
    class MyType(ObjectType):
 | 
			
		||||
        field = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -191,7 +181,6 @@ def test_query_wrong_default_value():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_default_value_ignored_by_resolver():
 | 
			
		||||
 | 
			
		||||
    class MyType(ObjectType):
 | 
			
		||||
        field = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -210,7 +199,6 @@ def test_query_default_value_ignored_by_resolver():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_resolve_function():
 | 
			
		||||
 | 
			
		||||
    class Query(ObjectType):
 | 
			
		||||
        hello = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -225,7 +213,6 @@ def test_query_resolve_function():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_arguments():
 | 
			
		||||
 | 
			
		||||
    class Query(ObjectType):
 | 
			
		||||
        test = String(a_str=String(), a_int=Int())
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -251,7 +238,6 @@ def test_query_arguments():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_input_field():
 | 
			
		||||
 | 
			
		||||
    class Input(InputObjectType):
 | 
			
		||||
        a_field = String()
 | 
			
		||||
        recursive_field = InputField(lambda: Input)
 | 
			
		||||
| 
						 | 
				
			
			@ -282,7 +268,6 @@ def test_query_input_field():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_query_middlewares():
 | 
			
		||||
 | 
			
		||||
    class Query(ObjectType):
 | 
			
		||||
        hello = String()
 | 
			
		||||
        other = String()
 | 
			
		||||
| 
						 | 
				
			
			@ -307,9 +292,7 @@ def test_query_middlewares():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_objecttype_on_instances():
 | 
			
		||||
 | 
			
		||||
    class Ship:
 | 
			
		||||
 | 
			
		||||
        def __init__(self, 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):
 | 
			
		||||
 | 
			
		||||
    class Container(ObjectType):
 | 
			
		||||
        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):
 | 
			
		||||
 | 
			
		||||
    class Container(ObjectType):
 | 
			
		||||
        x = 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(
 | 
			
		||||
    benchmark
 | 
			
		||||
):
 | 
			
		||||
 | 
			
		||||
    class Container(ObjectType):
 | 
			
		||||
        x = Int()
 | 
			
		||||
        y = Int()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@ from ..scalars import Scalar
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_scalar():
 | 
			
		||||
 | 
			
		||||
    class JSONScalar(Scalar):
 | 
			
		||||
        """Documentation"""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,9 +24,9 @@ from ..typemap import TypeMap, resolve_type
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_enum():
 | 
			
		||||
 | 
			
		||||
    class MyEnum(Enum):
 | 
			
		||||
        """Description"""
 | 
			
		||||
 | 
			
		||||
        foo = 1
 | 
			
		||||
        bar = 2
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -58,9 +58,9 @@ def test_enum():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_objecttype():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        """Description"""
 | 
			
		||||
 | 
			
		||||
        foo = String(
 | 
			
		||||
            bar=String(description="Argument description", default_value="x"),
 | 
			
		||||
            description="Field description",
 | 
			
		||||
| 
						 | 
				
			
			@ -94,9 +94,9 @@ def test_objecttype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_dynamic_objecttype():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        """Description"""
 | 
			
		||||
 | 
			
		||||
        bar = Dynamic(lambda: Field(String))
 | 
			
		||||
        own = Field(lambda: MyObjectType)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -112,9 +112,9 @@ def test_dynamic_objecttype():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_interface():
 | 
			
		||||
 | 
			
		||||
    class MyInterface(Interface):
 | 
			
		||||
        """Description"""
 | 
			
		||||
 | 
			
		||||
        foo = String(
 | 
			
		||||
            bar=String(description="Argument description", default_value="x"),
 | 
			
		||||
            description="Field description",
 | 
			
		||||
| 
						 | 
				
			
			@ -151,7 +151,6 @@ def test_interface():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_inputobject():
 | 
			
		||||
 | 
			
		||||
    class OtherObjectType(InputObjectType):
 | 
			
		||||
        thingy = NonNull(Int)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -161,6 +160,7 @@ def test_inputobject():
 | 
			
		|||
 | 
			
		||||
    class MyInputObjectType(InputObjectType):
 | 
			
		||||
        """Description"""
 | 
			
		||||
 | 
			
		||||
        foo_bar = String(description="Field description")
 | 
			
		||||
        bar = String(name="gizmo")
 | 
			
		||||
        baz = NonNull(MyInnerObjectType)
 | 
			
		||||
| 
						 | 
				
			
			@ -210,9 +210,9 @@ def test_inputobject():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_objecttype_camelcase():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        """Description"""
 | 
			
		||||
 | 
			
		||||
        foo_bar = String(bar_foo=String())
 | 
			
		||||
 | 
			
		||||
    typemap = TypeMap([MyObjectType])
 | 
			
		||||
| 
						 | 
				
			
			@ -232,9 +232,9 @@ def test_objecttype_camelcase():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_objecttype_camelcase_disabled():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        """Description"""
 | 
			
		||||
 | 
			
		||||
        foo_bar = String(bar_foo=String())
 | 
			
		||||
 | 
			
		||||
    typemap = TypeMap([MyObjectType], auto_camelcase=False)
 | 
			
		||||
| 
						 | 
				
			
			@ -254,7 +254,6 @@ def test_objecttype_camelcase_disabled():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_objecttype_with_possible_types():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        """Description"""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -271,7 +270,6 @@ def test_objecttype_with_possible_types():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_resolve_type_with_missing_type():
 | 
			
		||||
 | 
			
		||||
    class MyObjectType(ObjectType):
 | 
			
		||||
        foo_bar = String()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,6 @@ class MyObjectType2(ObjectType):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_union():
 | 
			
		||||
 | 
			
		||||
    class MyUnion(Union):
 | 
			
		||||
        """Documentation"""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -28,9 +27,7 @@ def test_generate_union():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_generate_union_with_meta():
 | 
			
		||||
 | 
			
		||||
    class MyUnion(Union):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            name = "MyOtherUnion"
 | 
			
		||||
            description = "Documentation"
 | 
			
		||||
| 
						 | 
				
			
			@ -50,9 +47,7 @@ def test_generate_union_with_no_types():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_union_can_be_mounted():
 | 
			
		||||
 | 
			
		||||
    class MyUnion(Union):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            types = (MyObjectType1, MyObjectType2)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,7 +74,6 @@ def is_type_of_from_possible_types(possible_types, root, info):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class TypeMap(GraphQLTypeMap):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, types, auto_camelcase=True, schema=None):
 | 
			
		||||
        self.auto_camelcase = auto_camelcase
 | 
			
		||||
        self.schema = schema
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,6 @@ from .deprecated import deprecated
 | 
			
		|||
 | 
			
		||||
@deprecated("This function is deprecated")
 | 
			
		||||
def resolve_only_args(func):
 | 
			
		||||
 | 
			
		||||
    @wraps(func)
 | 
			
		||||
    def wrapped_func(root, info, **args):
 | 
			
		||||
        return func(root, **args)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,6 +20,7 @@ class SubclassWithMeta_Meta(InitSubclassMeta):
 | 
			
		|||
 | 
			
		||||
class SubclassWithMeta(six.with_metaclass(SubclassWithMeta_Meta)):
 | 
			
		||||
    """This class improves __init_subclass__ to receive automatically the options from meta"""
 | 
			
		||||
 | 
			
		||||
    # We will only have the metaclass in Python 2
 | 
			
		||||
    def __init_subclass__(cls, **meta_options):
 | 
			
		||||
        """This method just terminates the super() chain"""
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,9 +106,7 @@ TEST_DATA = {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_example_end_to_end():
 | 
			
		||||
 | 
			
		||||
    class Movie(graphene.ObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            interfaces = (relay.Node,)
 | 
			
		||||
            default_resolver = dict_resolver
 | 
			
		||||
| 
						 | 
				
			
			@ -117,7 +115,6 @@ def test_example_end_to_end():
 | 
			
		|||
        synopsis = graphene.String(required=True)
 | 
			
		||||
 | 
			
		||||
    class Event(graphene.ObjectType):
 | 
			
		||||
 | 
			
		||||
        class Meta:
 | 
			
		||||
            interfaces = (relay.Node,)
 | 
			
		||||
            default_resolver = dict_resolver
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,6 @@ from ..trim_docstring import trim_docstring
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def test_trim_docstring():
 | 
			
		||||
 | 
			
		||||
    class WellDocumentedObject(object):
 | 
			
		||||
        """
 | 
			
		||||
        This object is very well-documented. It has multiple lines in its
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user