示例#1
0
def test_field_required_adds_validators():
    validators = Field(required=True).validators
    assert len(validators) == 1
    assert isinstance(validators[0], avocato_validators.Required)
示例#2
0
def test_field_to_value_returns_unmodified_value(value, expected):
    assert Field().to_value(value) == expected
示例#3
0
def test_field_as_getter_returns_none():
    assert Field().as_getter(None, None) is None
示例#4
0
 class ASerializer(Serializer):
     foo = Field()
示例#5
0
 class ASerializer(Serializer):
     a = Field()
示例#6
0
 class ASerializer(DictSerializer):
     a = Field(required=False)
示例#7
0
 class ASerializer(DictSerializer):
     a = Field()
示例#8
0
 class ABSerializer(ASerializer):
     b = Field()
示例#9
0
 class ASerializer(DictSerializer):
     a = IntField()
     b = Field(attr='foo')
示例#10
0
 class CSerializer(Serializer):
     c = Field()
示例#11
0
 class ASerializer(Serializer):
     foo = Field(call=True)
示例#12
0
 class ASerializer(Serializer):
     a = Field('a.b.c')