From 40a15bdd2175f51c8f3b4c9fcee2cd1865b8d876 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Sun, 23 Jul 2017 20:56:00 -0700 Subject: [PATCH] Improved test coverage --- graphene/relay/connection.py | 8 ++++++++ setup.cfg | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/graphene/relay/connection.py b/graphene/relay/connection.py index 20a5e648..5470e57e 100644 --- a/graphene/relay/connection.py +++ b/graphene/relay/connection.py @@ -9,6 +9,8 @@ from ..types import (Boolean, Enum, Int, Interface, List, NonNull, Scalar, String, Union) from ..types.field import Field from ..types.objecttype import ObjectType, ObjectTypeOptions +from ..utils.deprecated import warn_deprecation +from .node import is_node class PageInfo(ObjectType): @@ -98,6 +100,12 @@ class IterableConnectionField(Field): def type(self): type = super(IterableConnectionField, self).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), ( '{} type have to be a subclass of Connection. Received "{}".' ).format(self.__class__.__name__, connection_type) diff --git a/setup.cfg b/setup.cfg index d83176f0..efe77690 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ exclude = setup.py,docs/*,*/examples/*,graphene/pyutils/*,tests max-line-length = 120 [coverage:run] -omit = graphene/pyutils/*,*/tests/* +omit = graphene/pyutils/*,*/tests/*,graphene/types/scalars.py [isort] known_first_party=graphene