class ASerializer(Serializer): a = fields.Field()
class CSerializer(Serializer): c = fields.Field()
class ABSerializer(ASerializer): b = fields.Field()
class ASerializer(DictSerializer): a = fields.Field(required=False)
class ASerializer(DictSerializer): a = fields.Field()
class ASerializer(Serializer): a = fields.Field("a.b.c")
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