              longitude = serializers.FloatField(source='x')
              latitude = serializers.FloatField(source='y')
  
              def to_internal_value(self, data):
                  kwargs = super(NestedPointSerializer, self).to_internal_value(data)
                  return Point(srid=4326, **kwargs)
  
          serializer = NestedPointSerializer(data={'longitude': 6.958307, 'latitude': 50.941357})
          assert serializer.is_valid()
          assert isinstance(serializer.validated_data, Point)
 
</s> remove     @unittest.skipUnless(ChainMap, 'requires python 3.3')
 </s> add  </s> remove         assert serializer.errors == {'target': ['Incorrect type. Expected pk value, received %s.' % six.text_type.__name__]}
 </s> add         assert serializer.errors == {'target': ['Incorrect type. Expected pk value, received str.']} </s> remove         super(_UnvalidatedField, self).__init__(*args, **kwargs)
 </s> add         super().__init__(*args, **kwargs) </s> remove         super(FileField, self).__init__(*args, **kwargs)
 </s> add         super().__init__(*args, **kwargs) </s> remove         text_type_string = six.text_type.__name__
        message = 'Invalid data. Expected a dictionary, but got %s.' % text_type_string
 </s> add         message = 'Invalid data. Expected a dictionary, but got str.'
                kwargs = super().to_internal_value(data)
              longitude = serializers.FloatField(source='x')
              latitude = serializers.FloatField(source='y')
  
              def to_internal_value(self, data):
                kwargs = super().to_internal_value(data)
                  return Point(srid=4326, **kwargs)
  
          serializer = NestedPointSerializer(data={'longitude': 6.958307, 'latitude': 50.941357})
          assert serializer.is_valid()
          assert isinstance(serializer.validated_data, Point)
keep keep keep keep replace keep keep keep keep keep
 Dropped Python 2 compatibility. (#6615)

Thanks to Jon Dufresne (@jdufresne) for review.

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Co-authored-by: Rizwan Mansuri <Rizwan@webbyfox.com> 
tests/test_serializer.py