def test_stringfield_type(): f = StringField() f.contribute_to_class(MyOt, 'field_name') assert schema.T(f) == GraphQLString
def test_field_repr_contributed(): f = StringField().as_field() f.contribute_to_class(MyOt, 'field_name') assert repr(f) == "<graphene.core.types.field.Field: field_name>"
def test_field_resolve_objecttype_cos(): f = StringField().as_field() f.contribute_to_class(MyOt, 'customdoc') field = schema.T(f) assert field.description == 'Resolver documentation'
def test_field_resolve(): f = StringField(required=True, resolve=lambda *args: 'RESOLVED') f.contribute_to_class(ot, 'field_name') field_type = f.internal_field(schema) assert 'RESOLVED' == field_type.resolver(ot, None, None)
def test_field_str(): f = StringField().as_field() f.contribute_to_class(MyOt, 'field_name') assert str(f) == "MyOt.field_name"
def test_stringfield_type_required(): f = StringField(required=True) f.contribute_to_class(ot, 'field_name') assert isinstance(f.internal_field(schema), GraphQLField) assert isinstance(f.internal_type(schema), GraphQLNonNull)
def test_field_repr_contributed(): f = StringField() f.contribute_to_class(ot, 'field_name') assert repr(f) == "<graphene.core.fields.StringField: field_name>"
def test_field_resolve_objecttype_cos(): f = StringField() f.contribute_to_class(ot, 'customdoc') field = f.internal_field(schema) assert field.description == 'Resolver documentation'
def test_field_resolve(): f = StringField(required=True, resolve=lambda *args: 'RESOLVED').as_field() f.contribute_to_class(MyOt, 'field_name') field_type = schema.T(f) assert 'RESOLVED' == field_type.resolver(MyOt, None, None)
def test_field_str(): f = StringField() f.contribute_to_class(ot, 'field_name') assert str(f) == "ObjectType.field_name"
def test_stringfield_type_required(): f = StringField(required=True).as_field() f.contribute_to_class(MyOt, 'field_name') assert isinstance(schema.T(f), GraphQLField) assert isinstance(schema.T(f).type, GraphQLNonNull)
def test_stringfield_type(): f = StringField() f.contribute_to_class(ot, 'field_name') assert f.internal_type(schema) == GraphQLString