mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-27 08:19:45 +03:00
comparing multiline string
This commit is contained in:
parent
072c4a397c
commit
c2e0a41617
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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__"):
|
||||
|
|
Loading…
Reference in New Issue
Block a user