diff --git a/graphene/types/tests/test_objecttype.py b/graphene/types/tests/test_objecttype.py index 2acb578f..d2ae4ade 100644 --- a/graphene/types/tests/test_objecttype.py +++ b/graphene/types/tests/test_objecttype.py @@ -7,6 +7,7 @@ from ..scalars import String from ..schema import Schema from ..structures import NonNull from ..unmountedtype import UnmountedType +import re class MyType(Interface): @@ -228,11 +229,13 @@ def test_objecttype_with_possible_types_and_is_type_of_should_raise(): def is_type_of(cls, root, context, info): return False - assert str(excinfo.value) == ( - "MyObjectType.Meta.possible_types will cause type collision with " - "MyObjectType.is_type_of. Please use one or other." - ) - + assertion_message = ''' + MyObjectType.Meta.possible_types will cause type collision with MyObjectType.is_type_of. + Please use one or other. + ''' + space_removed_excinfo = str(excinfo.value).replace(" ", "") + space_removed_assertion_message = assertion_message.replace(" ", "") + assert space_removed_assertion_message == space_removed_excinfo def test_objecttype_no_fields_output(): class User(ObjectType): diff --git a/graphene/types/typemap.py b/graphene/types/typemap.py index f79dae6f..b0aca624 100644 --- a/graphene/types/typemap.py +++ b/graphene/types/typemap.py @@ -264,10 +264,10 @@ class TypeMap(GraphQLTypeMap): for objecttype in type._meta.types: self.graphene_reducer(map, objecttype) internal_type = map[objecttype._meta.name] - if internal_type.graphql_type != objecttype: + if internal_type.graphene_type != objecttype: raise AssertionError( "Found different types with the same name in the schema: {}, {}." - .format(internal_type.graphql_type, objecttype) + .format(internal_type.graphene_type, objecttype) ) union_types.append(internal_type) return union_types diff --git a/graphene/utils/subclass_with_meta.py b/graphene/utils/subclass_with_meta.py index 01fc5375..b6dc0553 100644 --- a/graphene/utils/subclass_with_meta.py +++ b/graphene/utils/subclass_with_meta.py @@ -42,10 +42,14 @@ class SubclassWithMeta(six.with_metaclass(SubclassWithMeta_Meta)): abstract = options.pop("abstract", False) if abstract: - assert not options, ( - "Abstract types can only contain the abstract attribute. " - "Received: abstract, {option_keys}" - ).format(option_keys=", ".join(options.keys())) + if options: + raise AssertionError( + ''' + Abstract types can only contain the abstract attribute. + Received: abstract, {option_keys} + ''' + .format(option_keys=', '.join(options.keys())) + ) else: super_class = super(cls, cls) if hasattr(super_class, "__init_subclass_with_meta__"):