Improved test coverage

This commit is contained in:
Syrus Akbary 2017-07-23 20:56:00 -07:00
parent 66468e3ea5
commit 40a15bdd21
2 changed files with 9 additions and 1 deletions

View File

@ -9,6 +9,8 @@ from ..types import (Boolean, Enum, Int, Interface, List, NonNull, Scalar,
String, 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.deprecated import warn_deprecation
from .node import is_node
class PageInfo(ObjectType): class PageInfo(ObjectType):
@ -98,6 +100,12 @@ class IterableConnectionField(Field):
def type(self): def type(self):
type = super(IterableConnectionField, self).type type = super(IterableConnectionField, self).type
connection_type = type connection_type = type
if is_node(type):
warn_deprecation(
"ConnectionField's now need a explicit ConnectionType for Nodes.\n"
"Read more: https://github.com/graphql-python/graphene/blob/2.0/UPGRADE-v2.0.md#node-connections"
)
assert issubclass(connection_type, Connection), ( assert issubclass(connection_type, Connection), (
'{} type have to be a subclass of Connection. Received "{}".' '{} type have to be a subclass of Connection. Received "{}".'
).format(self.__class__.__name__, connection_type) ).format(self.__class__.__name__, connection_type)

View File

@ -3,7 +3,7 @@ exclude = setup.py,docs/*,*/examples/*,graphene/pyutils/*,tests
max-line-length = 120 max-line-length = 120
[coverage:run] [coverage:run]
omit = graphene/pyutils/*,*/tests/* omit = graphene/pyutils/*,*/tests/*,graphene/types/scalars.py
[isort] [isort]
known_first_party=graphene known_first_party=graphene