Example #1
0
 class ASerializer(Serializer):
     a = fields.Field()
Example #2
0
 class CSerializer(Serializer):
     c = fields.Field()
Example #3
0
 class ABSerializer(ASerializer):
     b = fields.Field()
Example #4
0
 class ASerializer(DictSerializer):
     a = fields.Field(required=False)
Example #5
0
 class ASerializer(DictSerializer):
     a = fields.Field()
Example #6
0
 class ASerializer(Serializer):
     a = fields.Field("a.b.c")
Example #7
0
 class ASerializer(DictSerializer):
     a = fields.IntegerField()
     b = fields.Field(attr_name="foo")
def test_is_to_value_overridden_for_base_field_should_be_false():
    field = fields.Field()
    assert field._is_to_value_overridden() is False
def test_as_getter_method_of_base_field_should_return_none():
    assert fields.Field().as_getter(None, None) is None
def test_to_value_method_of_base_field_should_return_its_input():
    assert fields.Field().to_value(5) == 5
    assert fields.Field().to_value("a") == "a"
    assert fields.Field().to_value(None) is None