mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-09 08:00:39 +03:00
Fixed Flake issues
This commit is contained in:
parent
3fbc3281a2
commit
f1624af08a
|
@ -12,6 +12,7 @@ class Query(graphene.ObjectType):
|
||||||
def resolve_me(self, args, context, info):
|
def resolve_me(self, args, context, info):
|
||||||
return context['user']
|
return context['user']
|
||||||
|
|
||||||
|
|
||||||
schema = graphene.Schema(query=Query)
|
schema = graphene.Schema(query=Query)
|
||||||
query = '''
|
query = '''
|
||||||
query something{
|
query something{
|
||||||
|
|
|
@ -14,6 +14,7 @@ class Query(graphene.ObjectType):
|
||||||
def resolve_patron(self, args, context, info):
|
def resolve_patron(self, args, context, info):
|
||||||
return Patron(id=1, name='Syrus', age=27)
|
return Patron(id=1, name='Syrus', age=27)
|
||||||
|
|
||||||
|
|
||||||
schema = graphene.Schema(query=Query)
|
schema = graphene.Schema(query=Query)
|
||||||
query = '''
|
query = '''
|
||||||
query something{
|
query something{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from graphene.test import Client
|
from graphene.test import Client
|
||||||
|
|
||||||
from ..data import setup
|
from ..data import setup
|
||||||
from ..schema import schema
|
from ..schema import schema
|
||||||
|
|
||||||
|
@ -6,6 +7,7 @@ setup()
|
||||||
|
|
||||||
client = Client(schema)
|
client = Client(schema)
|
||||||
|
|
||||||
|
|
||||||
def test_hero_name_query(snapshot):
|
def test_hero_name_query(snapshot):
|
||||||
query = '''
|
query = '''
|
||||||
query HeroNameQuery {
|
query HeroNameQuery {
|
||||||
|
@ -17,7 +19,6 @@ def test_hero_name_query(snapshot):
|
||||||
snapshot.assert_match(client.execute(query))
|
snapshot.assert_match(client.execute(query))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_hero_name_and_friends_query(snapshot):
|
def test_hero_name_and_friends_query(snapshot):
|
||||||
query = '''
|
query = '''
|
||||||
query HeroNameAndFriendsQuery {
|
query HeroNameAndFriendsQuery {
|
||||||
|
|
|
@ -18,6 +18,7 @@ class Ship(graphene.ObjectType):
|
||||||
|
|
||||||
|
|
||||||
class ShipConnection(relay.Connection):
|
class ShipConnection(relay.Connection):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
node = Ship
|
node = Ship
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from graphene.test import Client
|
from graphene.test import Client
|
||||||
|
|
||||||
from ..data import setup
|
from ..data import setup
|
||||||
from ..schema import schema
|
from ..schema import schema
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from graphene.test import Client
|
from graphene.test import Client
|
||||||
|
|
||||||
from ..data import setup
|
from ..data import setup
|
||||||
from ..schema import schema
|
from ..schema import schema
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from graphene.test import Client
|
from graphene.test import Client
|
||||||
|
|
||||||
from ..data import setup
|
from ..data import setup
|
||||||
from ..schema import schema
|
from ..schema import schema
|
||||||
|
|
||||||
|
|
|
@ -74,4 +74,7 @@ if not __SETUP__:
|
||||||
'ConnectionField',
|
'ConnectionField',
|
||||||
'PageInfo',
|
'PageInfo',
|
||||||
'lazy_import',
|
'lazy_import',
|
||||||
|
|
||||||
|
# Deprecated
|
||||||
|
'AbstractType',
|
||||||
]
|
]
|
||||||
|
|
|
@ -21,6 +21,7 @@ def test__is_dunder():
|
||||||
for name in non_dunder_names:
|
for name in non_dunder_names:
|
||||||
assert _is_dunder(name) is False
|
assert _is_dunder(name) is False
|
||||||
|
|
||||||
|
|
||||||
def test__is_sunder():
|
def test__is_sunder():
|
||||||
sunder_names = [
|
sunder_names = [
|
||||||
'_i_',
|
'_i_',
|
||||||
|
|
|
@ -2,16 +2,13 @@ import re
|
||||||
from collections import Iterable, OrderedDict
|
from collections import Iterable, OrderedDict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from graphql_relay import connection_from_list
|
from graphql_relay import connection_from_list
|
||||||
from promise import Promise, is_thenable
|
from promise import Promise, is_thenable
|
||||||
|
|
||||||
from ..types import (Boolean, Enum, Int, Interface, List, NonNull, Scalar, String,
|
from ..types import (Boolean, Enum, Int, Interface, List, NonNull, Scalar,
|
||||||
Union)
|
String, Union)
|
||||||
from ..types.field import Field
|
from ..types.field import Field
|
||||||
from ..types.objecttype import ObjectType, ObjectTypeOptions
|
from ..types.objecttype import ObjectType, ObjectTypeOptions
|
||||||
from ..utils.props import props
|
|
||||||
from .node import is_node
|
from .node import is_node
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,8 +41,10 @@ class ConnectionOptions(ObjectTypeOptions):
|
||||||
|
|
||||||
|
|
||||||
class Connection(ObjectType):
|
class Connection(ObjectType):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __init_subclass_with_meta__(cls, node=None, name=None, **options):
|
def __init_subclass_with_meta__(cls, node=None, name=None, **options):
|
||||||
_meta = ConnectionOptions(cls)
|
_meta = ConnectionOptions(cls)
|
||||||
|
@ -60,6 +59,7 @@ class Connection(ObjectType):
|
||||||
|
|
||||||
edge_class = getattr(cls, 'Edge', None)
|
edge_class = getattr(cls, 'Edge', None)
|
||||||
_node = node
|
_node = node
|
||||||
|
|
||||||
class EdgeBase(object):
|
class EdgeBase(object):
|
||||||
node = Field(_node, description='The item at the end of the edge')
|
node = Field(_node, description='The item at the end of the edge')
|
||||||
cursor = String(required=True, description='A cursor for use in pagination')
|
cursor = String(required=True, description='A cursor for use in pagination')
|
||||||
|
|
|
@ -3,12 +3,12 @@ from collections import OrderedDict
|
||||||
|
|
||||||
from promise import Promise
|
from promise import Promise
|
||||||
|
|
||||||
from ..types import Field, AbstractType, Argument, InputObjectType, String, Field
|
from ..types import Field, InputObjectType, String
|
||||||
from ..types.mutation import Mutation, MutationOptions
|
from ..types.mutation import Mutation
|
||||||
from ..utils.props import props
|
|
||||||
|
|
||||||
|
|
||||||
class ClientIDMutation(Mutation):
|
class ClientIDMutation(Mutation):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from graphql_relay import from_global_id, to_global_id
|
from graphql_relay import from_global_id, to_global_id
|
||||||
|
|
||||||
from ..types import ID, Field, Interface, ObjectType
|
from ..types import ID, Field, Interface, ObjectType
|
||||||
from ..types.utils import get_type
|
|
||||||
from ..types.interface import InterfaceOptions
|
from ..types.interface import InterfaceOptions
|
||||||
|
from ..types.utils import get_type
|
||||||
|
|
||||||
|
|
||||||
def is_node(objecttype):
|
def is_node(objecttype):
|
||||||
|
@ -60,6 +58,7 @@ class NodeField(Field):
|
||||||
|
|
||||||
|
|
||||||
class AbstractNode(Interface):
|
class AbstractNode(Interface):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
from ...types import Field, List, NonNull, ObjectType, String, Argument, Int
|
from ...types import Argument, Field, Int, List, NonNull, ObjectType, String
|
||||||
from ..connection import Connection, PageInfo, ConnectionField
|
from ..connection import Connection, ConnectionField, PageInfo
|
||||||
from ..node import Node
|
from ..node import Node
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ def test_pageinfo():
|
||||||
|
|
||||||
def test_connectionfield():
|
def test_connectionfield():
|
||||||
class MyObjectConnection(Connection):
|
class MyObjectConnection(Connection):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
node = MyObject
|
node = MyObject
|
||||||
|
|
||||||
|
@ -118,6 +119,7 @@ def test_connectionfield():
|
||||||
|
|
||||||
def test_connectionfield_custom_args():
|
def test_connectionfield_custom_args():
|
||||||
class MyObjectConnection(Connection):
|
class MyObjectConnection(Connection):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
node = MyObject
|
node = MyObject
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ class Letter(ObjectType):
|
||||||
|
|
||||||
|
|
||||||
class LetterConnection(Connection):
|
class LetterConnection(Connection):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
node = Letter
|
node = Letter
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from graphql_relay import to_global_id
|
from graphql_relay import to_global_id
|
||||||
|
|
||||||
from ..node import Node, GlobalID
|
from ...types import ID, NonNull, ObjectType, String
|
||||||
from ...types import NonNull, ID, ObjectType, String
|
|
||||||
from ...types.definitions import GrapheneObjectType
|
from ...types.definitions import GrapheneObjectType
|
||||||
|
from ..node import GlobalID, Node
|
||||||
|
|
||||||
|
|
||||||
class CustomNode(Node):
|
class CustomNode(Node):
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from ...types import ( Argument, Field, InputField, ID,
|
from promise import Promise
|
||||||
InputObjectType, NonNull, ObjectType, Schema)
|
|
||||||
|
from ...types import (ID, Argument, Field, InputField, InputObjectType,
|
||||||
|
NonNull, ObjectType, Schema)
|
||||||
from ...types.scalars import String
|
from ...types.scalars import String
|
||||||
from ..mutation import ClientIDMutation
|
from ..mutation import ClientIDMutation
|
||||||
from ..node import Node
|
|
||||||
from promise import Promise
|
|
||||||
|
|
||||||
|
|
||||||
class SharedFields(object):
|
class SharedFields(object):
|
||||||
|
@ -20,6 +20,7 @@ class MyNode(ObjectType):
|
||||||
|
|
||||||
|
|
||||||
class SaySomething(ClientIDMutation):
|
class SaySomething(ClientIDMutation):
|
||||||
|
|
||||||
class Input:
|
class Input:
|
||||||
what = String()
|
what = String()
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ class SaySomething(ClientIDMutation):
|
||||||
|
|
||||||
|
|
||||||
class SaySomethingPromise(ClientIDMutation):
|
class SaySomethingPromise(ClientIDMutation):
|
||||||
|
|
||||||
class Input:
|
class Input:
|
||||||
what = String()
|
what = String()
|
||||||
|
|
||||||
|
@ -50,6 +52,7 @@ class MyEdge(ObjectType):
|
||||||
|
|
||||||
|
|
||||||
class OtherMutation(ClientIDMutation):
|
class OtherMutation(ClientIDMutation):
|
||||||
|
|
||||||
class Input(SharedFields):
|
class Input(SharedFields):
|
||||||
additional_field = String()
|
additional_field = String()
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ from collections import OrderedDict
|
||||||
from graphql_relay import to_global_id
|
from graphql_relay import to_global_id
|
||||||
|
|
||||||
from ...types import ObjectType, Schema, String
|
from ...types import ObjectType, Schema, String
|
||||||
from ..connection import Connection
|
|
||||||
from ..node import Node
|
from ..node import Node
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +104,7 @@ def test_node_field_only_type_wrong():
|
||||||
)
|
)
|
||||||
assert len(executed.errors) == 1
|
assert len(executed.errors) == 1
|
||||||
assert str(executed.errors[0]) == 'Must receive an MyOtherNode id.'
|
assert str(executed.errors[0]) == 'Must receive an MyOtherNode id.'
|
||||||
assert executed.data == { 'onlyNode': None }
|
assert executed.data == {'onlyNode': None}
|
||||||
|
|
||||||
|
|
||||||
def test_node_field_only_lazy_type():
|
def test_node_field_only_lazy_type():
|
||||||
|
@ -122,7 +121,7 @@ def test_node_field_only_lazy_type_wrong():
|
||||||
)
|
)
|
||||||
assert len(executed.errors) == 1
|
assert len(executed.errors) == 1
|
||||||
assert str(executed.errors[0]) == 'Must receive an MyOtherNode id.'
|
assert str(executed.errors[0]) == 'Must receive an MyOtherNode id.'
|
||||||
assert executed.data == { 'onlyNodeLazy': None }
|
assert executed.data == {'onlyNodeLazy': None}
|
||||||
|
|
||||||
|
|
||||||
def test_str_schema():
|
def test_str_schema():
|
||||||
|
|
|
@ -29,6 +29,7 @@ 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
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import resolve_only_args
|
from graphene import resolve_only_args
|
||||||
|
|
||||||
|
|
||||||
class Query(graphene.ObjectType):
|
class Query(graphene.ObjectType):
|
||||||
rand = graphene.String()
|
rand = graphene.String()
|
||||||
|
|
||||||
|
|
||||||
class Success(graphene.ObjectType):
|
class Success(graphene.ObjectType):
|
||||||
yeah = graphene.String()
|
yeah = graphene.String()
|
||||||
|
|
||||||
|
@ -15,11 +17,13 @@ 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)
|
||||||
|
|
||||||
|
@ -37,6 +41,7 @@ class Mutations(graphene.ObjectType):
|
||||||
|
|
||||||
# tests.py
|
# tests.py
|
||||||
|
|
||||||
|
|
||||||
def test_create_post():
|
def test_create_post():
|
||||||
query_string = '''
|
query_string = '''
|
||||||
mutation {
|
mutation {
|
||||||
|
|
|
@ -1,19 +1,25 @@
|
||||||
# https://github.com/graphql-python/graphene/issues/356
|
# https://github.com/graphql-python/graphene/issues/356
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import relay
|
from graphene import relay
|
||||||
|
|
||||||
|
|
||||||
class SomeTypeOne(graphene.ObjectType):
|
class SomeTypeOne(graphene.ObjectType):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SomeTypeTwo(graphene.ObjectType):
|
class SomeTypeTwo(graphene.ObjectType):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MyUnion(graphene.Union):
|
class MyUnion(graphene.Union):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
types = (SomeTypeOne, SomeTypeTwo)
|
types = (SomeTypeOne, SomeTypeTwo)
|
||||||
|
|
||||||
|
|
||||||
def test_issue():
|
def test_issue():
|
||||||
with pytest.raises(Exception) as exc_info:
|
with pytest.raises(Exception) as exc_info:
|
||||||
class Query(graphene.ObjectType):
|
class Query(graphene.ObjectType):
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
# https://github.com/graphql-python/graphene/issues/425
|
# https://github.com/graphql-python/graphene/issues/425
|
||||||
# Adapted for Graphene 2.0
|
# Adapted for Graphene 2.0
|
||||||
import six
|
|
||||||
|
|
||||||
from graphene.types.objecttype import ObjectType, ObjectTypeOptions
|
from graphene.types.objecttype import ObjectType, ObjectTypeOptions
|
||||||
|
|
||||||
|
|
||||||
class SpecialOptions(ObjectTypeOptions):
|
class SpecialOptions(ObjectTypeOptions):
|
||||||
other_attr = None
|
other_attr = None
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
@ -18,6 +19,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!'
|
||||||
|
|
||||||
|
@ -36,5 +38,5 @@ def test_special_objecttype_inherit_meta_options():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
assert MyType._meta.name == 'MyType'
|
assert MyType._meta.name == 'MyType'
|
||||||
assert MyType._meta.default_resolver == None
|
assert MyType._meta.default_resolver is None
|
||||||
assert MyType._meta.interfaces == ()
|
assert MyType._meta.interfaces == ()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# https://github.com/graphql-python/graphene/issues/313
|
# https://github.com/graphql-python/graphene/issues/313
|
||||||
|
|
||||||
import graphene
|
import graphene
|
||||||
from graphene import resolve_only_args
|
|
||||||
|
|
||||||
|
|
||||||
class Query(graphene.ObjectType):
|
class Query(graphene.ObjectType):
|
||||||
|
|
|
@ -38,4 +38,7 @@ __all__ = [
|
||||||
'Argument',
|
'Argument',
|
||||||
'Dynamic',
|
'Dynamic',
|
||||||
'Union',
|
'Union',
|
||||||
|
|
||||||
|
# Deprecated
|
||||||
|
'AbstractType',
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
|
from .dynamic import Dynamic
|
||||||
from .mountedtype import MountedType
|
from .mountedtype import MountedType
|
||||||
from .structures import NonNull
|
from .structures import NonNull
|
||||||
from .dynamic import Dynamic
|
|
||||||
from .utils import get_type
|
from .utils import get_type
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ class BaseOptions(object):
|
||||||
|
|
||||||
|
|
||||||
class BaseType(SubclassWithMeta):
|
class BaseType(SubclassWithMeta):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __init_subclass_with_meta__(cls, name=None, description=None, _meta=None):
|
def __init_subclass_with_meta__(cls, name=None, description=None, _meta=None):
|
||||||
assert "_meta" not in cls.__dict__, "Can't assign directly meta"
|
assert "_meta" not in cls.__dict__, "Can't assign directly meta"
|
||||||
|
|
|
@ -2,10 +2,10 @@ from collections import OrderedDict
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from graphene.utils.subclass_with_meta import SubclassWithMeta_Meta
|
||||||
|
|
||||||
from .base import BaseOptions, BaseType
|
from .base import BaseOptions, BaseType
|
||||||
from .unmountedtype import UnmountedType
|
from .unmountedtype import UnmountedType
|
||||||
from graphene.pyutils.init_subclass import InitSubclassMeta
|
|
||||||
from graphene.utils.subclass_with_meta import SubclassWithMeta_Meta
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from enum import Enum as PyEnum
|
from enum import Enum as PyEnum
|
||||||
|
@ -27,6 +27,7 @@ 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 = PyEnum(cls.__name__, OrderedDict(classdict, __eq__=eq_enum))
|
enum = PyEnum(cls.__name__, OrderedDict(classdict, __eq__=eq_enum))
|
||||||
return SubclassWithMeta_Meta.__new__(cls, name, bases, OrderedDict(classdict, __enum__=enum), **options)
|
return SubclassWithMeta_Meta.__new__(cls, name, bases, OrderedDict(classdict, __enum__=enum), **options)
|
||||||
|
@ -53,6 +54,7 @@ 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, **options):
|
def __init_subclass_with_meta__(cls, enum=None, **options):
|
||||||
_meta = EnumOptions(cls)
|
_meta = EnumOptions(cls)
|
||||||
|
|
|
@ -8,7 +8,6 @@ from .structures import NonNull
|
||||||
from .unmountedtype import UnmountedType
|
from .unmountedtype import UnmountedType
|
||||||
from .utils import get_type
|
from .utils import get_type
|
||||||
|
|
||||||
|
|
||||||
base_type = type
|
base_type = type
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from graphene.types.scalars import MAX_INT, MIN_INT
|
||||||
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
|
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
|
||||||
StringValue, ListValue, ObjectValue)
|
ListValue, ObjectValue, StringValue)
|
||||||
|
|
||||||
from graphene.types.scalars import MIN_INT, MAX_INT
|
|
||||||
from .scalars import Scalar
|
from .scalars import Scalar
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
from .base import BaseOptions, BaseType
|
||||||
from .inputfield import InputField
|
from .inputfield import InputField
|
||||||
from .unmountedtype import UnmountedType
|
from .unmountedtype import UnmountedType
|
||||||
from .utils import yank_fields_from_attrs
|
from .utils import yank_fields_from_attrs
|
||||||
|
|
||||||
from .base import BaseOptions, BaseType
|
|
||||||
|
|
||||||
|
|
||||||
class InputObjectTypeOptions(BaseOptions):
|
class InputObjectTypeOptions(BaseOptions):
|
||||||
fields = None # type: Dict[str, Field]
|
fields = None # type: Dict[str, Field]
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from .field import Field
|
|
||||||
from .utils import yank_fields_from_attrs
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from .base import BaseOptions, BaseType
|
from .base import BaseOptions, BaseType
|
||||||
|
from .field import Field
|
||||||
|
from .utils import yank_fields_from_attrs
|
||||||
|
|
||||||
|
|
||||||
class InterfaceOptions(BaseOptions):
|
class InterfaceOptions(BaseOptions):
|
||||||
|
|
|
@ -3,10 +3,8 @@ from collections import OrderedDict
|
||||||
from ..utils.get_unbound_function import get_unbound_function
|
from ..utils.get_unbound_function import get_unbound_function
|
||||||
from ..utils.props import props
|
from ..utils.props import props
|
||||||
from .field import Field
|
from .field import Field
|
||||||
from .utils import yank_fields_from_attrs
|
|
||||||
from .objecttype import ObjectType, ObjectTypeOptions
|
from .objecttype import ObjectType, ObjectTypeOptions
|
||||||
|
from .utils import yank_fields_from_attrs
|
||||||
from .base import BaseOptions, BaseType
|
|
||||||
|
|
||||||
|
|
||||||
class MutationOptions(ObjectTypeOptions):
|
class MutationOptions(ObjectTypeOptions):
|
||||||
|
@ -20,7 +18,8 @@ class Mutation(ObjectType):
|
||||||
Mutation Type Definition
|
Mutation Type Definition
|
||||||
'''
|
'''
|
||||||
@classmethod
|
@classmethod
|
||||||
def __init_subclass_with_meta__(cls, resolver=None, output=None, arguments=None, _meta=None, abstract=False, **options):
|
def __init_subclass_with_meta__(cls, resolver=None, output=None, arguments=None,
|
||||||
|
_meta=None, abstract=False, **options):
|
||||||
if abstract:
|
if abstract:
|
||||||
return
|
return
|
||||||
if not _meta:
|
if not _meta:
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
from .base import BaseOptions, BaseType
|
||||||
from .field import Field
|
from .field import Field
|
||||||
from .interface import Interface
|
from .interface import Interface
|
||||||
from .utils import yank_fields_from_attrs
|
from .utils import yank_fields_from_attrs
|
||||||
|
|
||||||
from .base import BaseOptions, BaseType
|
|
||||||
|
|
||||||
|
|
||||||
class ObjectTypeOptions(BaseOptions):
|
class ObjectTypeOptions(BaseOptions):
|
||||||
fields = None # type: Dict[str, Field]
|
fields = None # type: Dict[str, Field]
|
||||||
|
@ -20,7 +19,10 @@ class ObjectType(BaseType):
|
||||||
have a name, but most importantly describe their fields.
|
have a name, but most importantly describe their fields.
|
||||||
'''
|
'''
|
||||||
@classmethod
|
@classmethod
|
||||||
def __init_subclass_with_meta__(cls, interfaces=(), possible_types=(), default_resolver=None, _meta=None, abstract=False, **options):
|
def __init_subclass_with_meta__(
|
||||||
|
cls, interfaces=(),
|
||||||
|
possible_types=(),
|
||||||
|
default_resolver=None, _meta=None, abstract=False, **options):
|
||||||
if abstract:
|
if abstract:
|
||||||
return
|
return
|
||||||
if not _meta:
|
if not _meta:
|
||||||
|
@ -31,7 +33,7 @@ class ObjectType(BaseType):
|
||||||
for interface in interfaces:
|
for interface in interfaces:
|
||||||
assert issubclass(interface, Interface), (
|
assert issubclass(interface, Interface), (
|
||||||
'All interfaces of {} must be a subclass of Interface. Received "{}".'
|
'All interfaces of {} must be a subclass of Interface. Received "{}".'
|
||||||
).format(name, interface)
|
).format(cls.__name__, interface)
|
||||||
fields.update(interface._meta.fields)
|
fields.update(interface._meta.fields)
|
||||||
|
|
||||||
for base in reversed(cls.__mro__):
|
for base in reversed(cls.__mro__):
|
||||||
|
|
|
@ -3,8 +3,8 @@ import six
|
||||||
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
|
from graphql.language.ast import (BooleanValue, FloatValue, IntValue,
|
||||||
StringValue)
|
StringValue)
|
||||||
|
|
||||||
from .unmountedtype import UnmountedType
|
|
||||||
from .base import BaseOptions, BaseType
|
from .base import BaseOptions, BaseType
|
||||||
|
from .unmountedtype import UnmountedType
|
||||||
|
|
||||||
|
|
||||||
class ScalarOptions(BaseOptions):
|
class ScalarOptions(BaseOptions):
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import pytest
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from ..argument import Argument, to_arguments
|
from ..argument import Argument, to_arguments
|
||||||
from ..field import Field
|
from ..field import Field
|
||||||
from ..inputfield import InputField
|
from ..inputfield import InputField
|
||||||
from ..structures import NonNull
|
|
||||||
from ..scalars import String
|
from ..scalars import String
|
||||||
|
from ..structures import NonNull
|
||||||
|
|
||||||
|
|
||||||
def test_argument():
|
def test_argument():
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from ..datetime import DateTime, Time
|
from ..datetime import DateTime, Time
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from ..structures import List, NonNull
|
|
||||||
from ..scalars import String
|
|
||||||
from ..dynamic import Dynamic
|
from ..dynamic import Dynamic
|
||||||
|
from ..scalars import String
|
||||||
|
from ..structures import List, NonNull
|
||||||
|
|
||||||
|
|
||||||
def test_dynamic():
|
def test_dynamic():
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
from ..argument import Argument
|
||||||
from ..enum import Enum, PyEnum
|
from ..enum import Enum, PyEnum
|
||||||
from ..field import Field
|
from ..field import Field
|
||||||
from ..inputfield import InputField
|
from ..inputfield import InputField
|
||||||
from ..argument import Argument
|
|
||||||
|
|
||||||
|
|
||||||
def test_enum_construction():
|
def test_enum_construction():
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import pytest
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from ..argument import Argument
|
from ..argument import Argument
|
||||||
from ..field import Field
|
from ..field import Field
|
||||||
from ..structures import NonNull
|
|
||||||
from ..scalars import String
|
from ..scalars import String
|
||||||
|
from ..structures import NonNull
|
||||||
from .utils import MyLazyType
|
from .utils import MyLazyType
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ def test_field_basic():
|
||||||
resolver = lambda: None
|
resolver = lambda: None
|
||||||
deprecation_reason = 'Deprecated now'
|
deprecation_reason = 'Deprecated now'
|
||||||
description = 'My Field'
|
description = 'My Field'
|
||||||
my_default='something'
|
my_default = 'something'
|
||||||
field = Field(
|
field = Field(
|
||||||
MyType,
|
MyType,
|
||||||
name='name',
|
name='name',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import pytest
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from ..inputfield import InputField
|
from ..inputfield import InputField
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
from ..field import Field
|
|
||||||
from ..argument import Argument
|
from ..argument import Argument
|
||||||
|
from ..field import Field
|
||||||
from ..inputfield import InputField
|
from ..inputfield import InputField
|
||||||
from ..objecttype import ObjectType
|
|
||||||
from ..inputobjecttype import InputObjectType
|
from ..inputobjecttype import InputObjectType
|
||||||
|
from ..objecttype import ObjectType
|
||||||
from ..unmountedtype import UnmountedType
|
from ..unmountedtype import UnmountedType
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import json
|
|
||||||
|
|
||||||
from ..json import JSONString
|
from ..json import JSONString
|
||||||
from ..objecttype import ObjectType
|
from ..objecttype import ObjectType
|
||||||
|
@ -19,7 +18,7 @@ def test_jsonstring_query():
|
||||||
json_value = '{"key": "value"}'
|
json_value = '{"key": "value"}'
|
||||||
|
|
||||||
json_value_quoted = json_value.replace('"', '\\"')
|
json_value_quoted = json_value.replace('"', '\\"')
|
||||||
result = schema.execute('''{ json(input: "%s") }'''%json_value_quoted)
|
result = schema.execute('''{ json(input: "%s") }''' % json_value_quoted)
|
||||||
assert not result.errors
|
assert not result.errors
|
||||||
assert result.data == {
|
assert result.data == {
|
||||||
'json': json_value
|
'json': json_value
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
from ..mountedtype import MountedType
|
|
||||||
from ..field import Field
|
from ..field import Field
|
||||||
from ..scalars import String
|
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)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from ..argument import Argument
|
||||||
|
from ..dynamic import Dynamic
|
||||||
from ..mutation import Mutation
|
from ..mutation import Mutation
|
||||||
from ..objecttype import ObjectType
|
from ..objecttype import ObjectType
|
||||||
from ..schema import Schema
|
|
||||||
from ..argument import Argument
|
|
||||||
from ..scalars import String
|
from ..scalars import String
|
||||||
from ..dynamic import Dynamic
|
from ..schema import Schema
|
||||||
|
|
||||||
|
|
||||||
def test_generate_mutation_no_args():
|
def test_generate_mutation_no_args():
|
||||||
|
@ -24,6 +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'
|
||||||
|
@ -52,6 +53,7 @@ def test_mutation_custom_output_type():
|
||||||
name = String()
|
name = String()
|
||||||
|
|
||||||
class CreateUser(Mutation):
|
class CreateUser(Mutation):
|
||||||
|
|
||||||
class Input:
|
class Input:
|
||||||
name = String()
|
name = String()
|
||||||
|
|
||||||
|
@ -70,6 +72,7 @@ def test_mutation_custom_output_type():
|
||||||
|
|
||||||
def test_mutation_execution():
|
def test_mutation_execution():
|
||||||
class CreateUser(Mutation):
|
class CreateUser(Mutation):
|
||||||
|
|
||||||
class Input:
|
class Input:
|
||||||
name = String()
|
name = String()
|
||||||
dynamic = Dynamic(lambda: String())
|
dynamic = Dynamic(lambda: String())
|
||||||
|
|
|
@ -187,6 +187,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, )
|
||||||
|
|
||||||
|
@ -196,6 +197,7 @@ def test_objecttype_with_possible_types():
|
||||||
def test_objecttype_with_possible_types_and_is_type_of_should_raise():
|
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, )
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
import json
|
import json
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from graphql import Source, execute, parse, GraphQLError
|
from graphql import GraphQLError, Source, execute, parse
|
||||||
|
|
||||||
|
from ..dynamic import Dynamic
|
||||||
from ..field import Field
|
from ..field import Field
|
||||||
from ..interface import Interface
|
|
||||||
from ..inputfield import InputField
|
from ..inputfield import InputField
|
||||||
from ..inputobjecttype import InputObjectType
|
from ..inputobjecttype import InputObjectType
|
||||||
|
from ..interface import Interface
|
||||||
from ..objecttype import ObjectType
|
from ..objecttype import ObjectType
|
||||||
from ..scalars import Int, String
|
from ..scalars import Int, String
|
||||||
from ..schema import Schema
|
from ..schema import Schema
|
||||||
from ..structures import List
|
from ..structures import List
|
||||||
from ..union import Union
|
from ..union import Union
|
||||||
from ..dynamic import Dynamic
|
|
||||||
|
|
||||||
|
|
||||||
def test_query():
|
def test_query():
|
||||||
|
@ -48,6 +48,7 @@ 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)
|
||||||
|
|
||||||
|
@ -81,6 +82,7 @@ def test_query_interface():
|
||||||
base = String()
|
base = String()
|
||||||
|
|
||||||
class One(ObjectType):
|
class One(ObjectType):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
interfaces = (MyInterface, )
|
interfaces = (MyInterface, )
|
||||||
|
|
||||||
|
@ -91,6 +93,7 @@ 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, )
|
||||||
|
|
||||||
|
@ -268,6 +271,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
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
from ..resolver import attr_resolver, dict_resolver, get_default_resolver, set_default_resolver
|
from ..resolver import (attr_resolver, dict_resolver, get_default_resolver,
|
||||||
|
set_default_resolver)
|
||||||
|
|
||||||
args = {}
|
args = {}
|
||||||
context = None
|
context = None
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import pytest
|
|
||||||
|
|
||||||
from ..scalars import Scalar
|
from ..scalars import Scalar
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from ..schema import Schema
|
from ..field import Field
|
||||||
from ..objecttype import ObjectType
|
from ..objecttype import ObjectType
|
||||||
from ..scalars import String
|
from ..scalars import String
|
||||||
from ..field import Field
|
from ..schema import Schema
|
||||||
|
|
||||||
|
|
||||||
class MyOtherType(ObjectType):
|
class MyOtherType(ObjectType):
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import pytest
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from ..structures import List, NonNull
|
import pytest
|
||||||
|
|
||||||
from ..scalars import String
|
from ..scalars import String
|
||||||
|
from ..structures import List, NonNull
|
||||||
from .utils import MyLazyType
|
from .utils import MyLazyType
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +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)
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,10 @@ from graphql.type.typemap import GraphQLTypeMap
|
||||||
|
|
||||||
from ..utils.get_unbound_function import get_unbound_function
|
from ..utils.get_unbound_function import get_unbound_function
|
||||||
from ..utils.str_converters import to_camel_case
|
from ..utils.str_converters import to_camel_case
|
||||||
from .definitions import (GrapheneEnumType, GrapheneInputObjectType,
|
from .definitions import (GrapheneEnumType, GrapheneGraphQLType,
|
||||||
GrapheneInterfaceType, GrapheneObjectType,
|
GrapheneInputObjectType, GrapheneInterfaceType,
|
||||||
GrapheneScalarType, GrapheneUnionType,
|
GrapheneObjectType, GrapheneScalarType,
|
||||||
GrapheneGraphQLType)
|
GrapheneUnionType)
|
||||||
from .dynamic import Dynamic
|
from .dynamic import Dynamic
|
||||||
from .enum import Enum
|
from .enum import Enum
|
||||||
from .field import Field
|
from .field import Field
|
||||||
|
@ -59,6 +59,7 @@ def is_type_of_from_possible_types(possible_types, root, context, 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
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
from .unmountedtype import UnmountedType
|
|
||||||
from .objecttype import ObjectType
|
|
||||||
|
|
||||||
from .base import BaseOptions, BaseType
|
from .base import BaseOptions, BaseType
|
||||||
|
from .unmountedtype import UnmountedType
|
||||||
|
|
||||||
|
|
||||||
class UnionOptions(BaseOptions):
|
class UnionOptions(BaseOptions):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import inspect
|
import inspect
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from six import string_types
|
from six import string_types
|
||||||
|
|
||||||
from ..utils.module_loading import import_string
|
from ..utils.module_loading import import_string
|
||||||
|
@ -40,6 +41,6 @@ def yank_fields_from_attrs(attrs, _as=None, sort=True):
|
||||||
def get_type(_type):
|
def get_type(_type):
|
||||||
if isinstance(_type, string_types):
|
if isinstance(_type, string_types):
|
||||||
return import_string(_type)
|
return import_string(_type)
|
||||||
if inspect.isfunction(_type) or type(_type) is partial:
|
if inspect.isfunction(_type) or isinstance(_type, partial):
|
||||||
return _type()
|
return _type()
|
||||||
return _type
|
return _type
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from .props import props
|
|
||||||
from ..pyutils.init_subclass import InitSubclassMeta
|
from ..pyutils.init_subclass import InitSubclassMeta
|
||||||
|
from .props import props
|
||||||
|
|
||||||
|
|
||||||
class SubclassWithMeta_Meta(InitSubclassMeta):
|
class SubclassWithMeta_Meta(InitSubclassMeta):
|
||||||
|
|
||||||
def __repr__(cls):
|
def __repr__(cls):
|
||||||
return cls._meta.name
|
return cls._meta.name
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
from pytest import raises
|
from pytest import raises
|
||||||
|
|
||||||
from graphene import String, ObjectType
|
from graphene import ObjectType, String
|
||||||
from ..module_loading import lazy_import, import_string
|
|
||||||
|
from ..module_loading import import_string, lazy_import
|
||||||
|
|
||||||
|
|
||||||
def test_import_string():
|
def test_import_string():
|
||||||
|
|
|
@ -9,7 +9,6 @@ def test_trim_docstring():
|
||||||
|
|
||||||
Multiple paragraphs too
|
Multiple paragraphs too
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
assert (trim_docstring(WellDocumentedObject.__doc__) ==
|
assert (trim_docstring(WellDocumentedObject.__doc__) ==
|
||||||
"This object is very well-documented. It has multiple lines in its\n"
|
"This object is very well-documented. It has multiple lines in its\n"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user