                  source.targets.add(target)
  
      def test_many_to_many_retrieve(self):
          queryset = ManyToManySource.objects.all()
          serializer = ManyToManySourceSerializer(queryset, many=True, context={'request': request})
          expected = [
              {'url': 'http://testserver/manytomanysource/1/', 'name': 'source-1', 'targets': ['http://testserver/manytomanytarget/1/']},
              {'url': 'http://testserver/manytomanysource/2/', 'name': 'source-2', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/2/']},
 
</s> remove         request = self.context.get('request', None)
        format = self.context.get('format', None)

        assert request is not None, (
 </s> add         assert 'request' in self.context, (
    def test_relative_hyperlinks(self):
        queryset = ManyToManySource.objects.all()
        serializer = ManyToManySourceSerializer(queryset, many=True, context={'request': None})
        expected = [
            {'url': '/manytomanysource/1/', 'name': 'source-1', 'targets': ['/manytomanytarget/1/']},
            {'url': '/manytomanysource/2/', 'name': 'source-2', 'targets': ['/manytomanytarget/1/', '/manytomanytarget/2/']},
            {'url': '/manytomanysource/3/', 'name': 'source-3', 'targets': ['/manytomanytarget/1/', '/manytomanytarget/2/', '/manytomanytarget/3/']}
        ]
        with self.assertNumQueries(4):
            self.assertEqual(serializer.data, expected)

                  source.targets.add(target)
  
    def test_relative_hyperlinks(self):
        queryset = ManyToManySource.objects.all()
        serializer = ManyToManySourceSerializer(queryset, many=True, context={'request': None})
        expected = [
            {'url': '/manytomanysource/1/', 'name': 'source-1', 'targets': ['/manytomanytarget/1/']},
            {'url': '/manytomanysource/2/', 'name': 'source-2', 'targets': ['/manytomanytarget/1/', '/manytomanytarget/2/']},
            {'url': '/manytomanysource/3/', 'name': 'source-3', 'targets': ['/manytomanytarget/1/', '/manytomanytarget/2/', '/manytomanytarget/3/']}
        ]
        with self.assertNumQueries(4):
            self.assertEqual(serializer.data, expected)

      def test_many_to_many_retrieve(self):
          queryset = ManyToManySource.objects.all()
          serializer = ManyToManySourceSerializer(queryset, many=True, context={'request': request})
          expected = [
              {'url': 'http://testserver/manytomanysource/1/', 'name': 'source-1', 'targets': ['http://testserver/manytomanytarget/1/']},
              {'url': 'http://testserver/manytomanysource/2/', 'name': 'source-2', 'targets': ['http://testserver/manytomanytarget/1/', 'http://testserver/manytomanytarget/2/']},
keep add keep keep keep keep keep keep
 Allow relative style hyperlinked URLs 
tests/test_relations_hyperlink.py