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