          }
  
          self.assertEqual(serializer.data, expected)
  
      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']})
  
  
  class SerializerMethodFieldTests(TestCase):
      def setUp(self):
  
          class BoopSerializer(serializers.Serializer):
 
</s> remove class TestManyRelateMixin(TestCase):
 </s> add class TestManyRelatedMixin(TestCase): </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,
)
          }
  
          self.assertEqual(serializer.data, expected)
  

















  
  class SerializerMethodFieldTests(TestCase):
      def setUp(self):
  
          class BoopSerializer(serializers.Serializer):
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 add tests for related field source for RelatedField and PrimaryKeyRelatedField. #694 
rest_framework/tests/serializer.py