Added NonNull restriction

This commit is contained in:
Syrus Akbary 2016-08-17 00:32:53 -07:00
parent e2904a4d6e
commit a48b41eaf9

View File

@ -40,6 +40,11 @@ class NonNull(Structure):
Note: the enforcement of non-nullability occurs within the executor.
'''
def __init__(self, *args, **kwargs):
super(NonNull, self).__init__(*args, **kwargs)
assert not isinstance(self.of_type, NonNull), (
'Can only create NonNull of a Nullable GraphQLType but got: {}.'
).format(type)
def __str__(self):
return '{}!'.format(self.of_type)