          representation = self.field.to_representation(MockObject(pk=''))
          assert representation is None
  
  
  class TestHyperlinkedIdentityField(APISimpleTestCase):
      def setUp(self):
          self.instance = MockObject(pk=1, name='foo')
          self.field = serializers.HyperlinkedIdentityField(view_name='example')
          self.field.reverse = mock_reverse
 
</s> remove             view_name='example', read_only=True)
 </s> add             view_name='example',
            lookup_field='name',
            lookup_url_kwarg='name',
            queryset=self.queryset,
        )
    def test_hyperlinked_related_lookup_exists(self):
        instance = self.field.to_internal_value('http://example.org/example/foobar/')
        assert instance is self.queryset.items[0]

    def test_hyperlinked_related_lookup_url_encoded_exists(self):
        instance = self.field.to_internal_value('http://example.org/example/baz%20qux/')
        assert instance is self.queryset.items[1]

    def test_hyperlinked_related_lookup_does_not_exist(self):
        with pytest.raises(serializers.ValidationError) as excinfo:
            self.field.to_internal_value('http://example.org/example/doesnotexist/')
        msg = excinfo.value.detail[0]
        assert msg == 'Invalid hyperlink - Object does not exist.'

          representation = self.field.to_representation(MockObject(pk=''))
          assert representation is None
  
    def test_hyperlinked_related_lookup_exists(self):
        instance = self.field.to_internal_value('http://example.org/example/foobar/')
        assert instance is self.queryset.items[0]

    def test_hyperlinked_related_lookup_url_encoded_exists(self):
        instance = self.field.to_internal_value('http://example.org/example/baz%20qux/')
        assert instance is self.queryset.items[1]

    def test_hyperlinked_related_lookup_does_not_exist(self):
        with pytest.raises(serializers.ValidationError) as excinfo:
            self.field.to_internal_value('http://example.org/example/doesnotexist/')
        msg = excinfo.value.detail[0]
        assert msg == 'Invalid hyperlink - Object does not exist.'

  
  class TestHyperlinkedIdentityField(APISimpleTestCase):
      def setUp(self):
          self.instance = MockObject(pk=1, name='foo')
          self.field = serializers.HyperlinkedIdentityField(view_name='example')
          self.field.reverse = mock_reverse
keep keep add keep keep keep keep keep keep
 add URL path unquote to HyperlinkedRelatedField.to_internal_value 
tests/test_relations.py