示例#1
0
def test_stringfield_type():
    f = StringField()
    f.contribute_to_class(MyOt, 'field_name')
    assert schema.T(f) == GraphQLString
示例#2
0
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>"
示例#3
0
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'
示例#4
0
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)
示例#5
0
def test_field_str():
    f = StringField().as_field()
    f.contribute_to_class(MyOt, 'field_name')
    assert str(f) == "MyOt.field_name"
示例#6
0
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>"
示例#7
0
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)
示例#8
0
def test_field_repr_contributed():
    f = StringField()
    f.contribute_to_class(ot, 'field_name')
    assert repr(f) == "<graphene.core.fields.StringField: field_name>"
示例#9
0
def test_field_resolve_objecttype_cos():
    f = StringField()
    f.contribute_to_class(ot, 'customdoc')
    field = f.internal_field(schema)
    assert field.description == 'Resolver documentation'
示例#10
0
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)
示例#11
0
def test_field_str():
    f = StringField()
    f.contribute_to_class(ot, 'field_name')
    assert str(f) == "ObjectType.field_name"
示例#12
0
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)
示例#13
0
def test_stringfield_type():
    f = StringField()
    f.contribute_to_class(MyOt, 'field_name')
    assert schema.T(f) == GraphQLString
示例#14
0
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'
示例#15
0
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)
示例#16
0
def test_stringfield_type():
    f = StringField()
    f.contribute_to_class(ot, 'field_name')
    assert f.internal_type(schema) == GraphQLString
示例#17
0
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)
示例#18
0
def test_field_str():
    f = StringField().as_field()
    f.contribute_to_class(MyOt, 'field_name')
    assert str(f) == "MyOt.field_name"