def test_field_required_adds_validators(): validators = Field(required=True).validators assert len(validators) == 1 assert isinstance(validators[0], avocato_validators.Required)
def test_field_to_value_returns_unmodified_value(value, expected): assert Field().to_value(value) == expected
def test_field_as_getter_returns_none(): assert Field().as_getter(None, None) is None
class ASerializer(Serializer): foo = Field()
class ASerializer(Serializer): a = Field()
class ASerializer(DictSerializer): a = Field(required=False)
class ASerializer(DictSerializer): a = Field()
class ABSerializer(ASerializer): b = Field()
class ASerializer(DictSerializer): a = IntField() b = Field(attr='foo')
class CSerializer(Serializer): c = Field()
class ASerializer(Serializer): foo = Field(call=True)
class ASerializer(Serializer): a = Field('a.b.c')