  import django
  from django.db import models
  from django.test import TestCase
  from django.core import validators
  from django.utils import unittest
  
  from rest_framework import serializers
  
  
  class TimestampedModel(models.Model):
 
</s> remove import django
 </s> add  </s> remove from rest_framework.compat import parse_date, parse_datetime
 </s> add  </s> remove from rest_framework.compat import parse_time
 </s> add from rest_framework.settings import api_settings </s> remove class DateObject(object):
    def __init__(self, date):
        self.date = date


class DateTimeObject(object):
    def __init__(self, date_time):
        self.date_time = date_time


class TimeObject(object):
    def __init__(self, time):
        self.time = time


 </s> add  </s> remove class DateObjectSerializer(serializers.Serializer):
    date = serializers.DateField()

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.date = attrs['date']
            return instance
        return DateObject(**attrs)


class DateObjectCustomFormatSerializer(serializers.Serializer):
    date = serializers.DateField(format=("%Y", "%Y -- %m"))

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.date = attrs['date']
            return instance
        return DateObject(**attrs)


class DateTimeObjectSerializer(serializers.Serializer):
    date_time = serializers.DateTimeField()

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.date_time = attrs['date_time']
            return instance
        return DateTimeObject(**attrs)


class DateTimeObjectCustomFormatSerializer(serializers.Serializer):
    date_time = serializers.DateTimeField(format=("%Y", "%Y %H:%M"))

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.date_time = attrs['date_time']
            return instance
        return DateTimeObject(**attrs)


class TimeObjectSerializer(serializers.Serializer):
    time = serializers.TimeField()

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.time = attrs['time']
            return instance
        return TimeObject(**attrs)


class TimeObjectCustomFormatSerializer(serializers.Serializer):
    time = serializers.TimeField(format=("%H -- %M", "%H%M%S"))

    def restore_object(self, attrs, instance=None):
        if instance is not None:
            instance.time = attrs['time']
            return instance
        return TimeObject(**attrs)


 </s> add 
  import django
  from django.db import models
  from django.test import TestCase
  from django.core import validators

  
  from rest_framework import serializers
  
  
  class TimestampedModel(models.Model):
keep keep keep keep replace keep keep keep keep keep
 Add drf settings + output format + testcases 
rest_framework/tests/fields.py