  from django.test import TestCase
  from rest_framework import serializers
  
  
  class NullModel(models.Model):
      pass
  
 
</s> remove class TestManyRelateMixin(TestCase):
 </s> add class TestManyRelatedMixin(TestCase): </s> remove     def test_queryset_nested_traversal(self):
        """
        Relational fields should be able to use methods as their source.
        """
        BlogPost.objects.create(title='blah')

        class QuerysetMethodSerializer(serializers.Serializer):
            blogposts = serializers.RelatedField(many=True, source='get_all_blogposts')

        class ClassWithQuerysetMethod(object):
            def get_all_blogposts(self):
                return BlogPost.objects

        obj = ClassWithQuerysetMethod()
        serializer = QuerysetMethodSerializer(obj)
        self.assertEqual(serializer.data, {'blogposts': ['BlogPost object']})

 </s> add  </s> remove from rest_framework.tests.models import ManyToManyTarget, ManyToManySource, ForeignKeyTarget, ForeignKeySource, NullableForeignKeySource, OneToOneTarget, NullableOneToOneSource
 </s> add from rest_framework.tests.models import (
    BlogPost, ManyToManyTarget, ManyToManySource, ForeignKeyTarget, ForeignKeySource,
    NullableForeignKeySource, OneToOneTarget, NullableOneToOneSource,
)
from rest_framework.tests.models import BlogPost
  from django.test import TestCase
  from rest_framework import serializers
from rest_framework.tests.models import BlogPost
  
  
  class NullModel(models.Model):
      pass
  
keep add keep keep keep keep keep
 add tests for related field source for RelatedField and PrimaryKeyRelatedField. #694 
rest_framework/tests/relations.py