      def test_callable_source_raises(self):
          class ExampleSerializer(serializers.Serializer):
              example_field = serializers.CharField(source='example_callable', read_only=True)
  
          class ExampleInstance(object):
              def example_callable(self):
                  raise AttributeError('method call failed')
  
          with pytest.raises(ValueError) as exc_info:
              serializer = ExampleSerializer(ExampleInstance())
 
</s> remove         class ExampleInstance(object):
 </s> add         class ExampleInstance: </s> remove         for validators in ([raise_exception], (raise_exception,), set([raise_exception])):
 </s> add         for validators in ([raise_exception], (raise_exception,), {raise_exception}): </s> remove         for validators in ([raise_exception], (raise_exception,), set([raise_exception])):
 </s> add         for validators in ([raise_exception], (raise_exception,), {raise_exception}): </s> remove         self.assertEqual(unicode_repr(TestSerializer()), expected)
 </s> add         self.assertEqual(repr(TestSerializer()), expected) </s> remove         self.assertEqual(unicode_repr(TestSerializer()), expected)
 </s> add         self.assertEqual(repr(TestSerializer()), expected)
        class ExampleInstance:
      def test_callable_source_raises(self):
          class ExampleSerializer(serializers.Serializer):
              example_field = serializers.CharField(source='example_callable', read_only=True)
  
        class ExampleInstance:
              def example_callable(self):
                  raise AttributeError('method call failed')
  
          with pytest.raises(ValueError) as exc_info:
              serializer = ExampleSerializer(ExampleInstance())
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_fields.py