          serializer = UniquenessSerializer(data=data)
          assert not serializer.is_valid()
          assert serializer.errors == {'username': ['uniqueness model with this username already exists.']}
  
      def test_is_unique(self):
          data = {'username': 'other'}
          serializer = UniquenessSerializer(data=data)
          assert serializer.is_valid()
          assert serializer.validated_data == {'username': 'other'}
  
 
</s> remove             validator = UniqueValidator(queryset=model_field.model._default_manager)
 </s> add             validator = UniqueValidator(
                queryset=model_field.model._default_manager,
                message=get_unique_error_message(model_field)) </s> remove             message=unique_error_message)
 </s> add             message=get_unique_error_message(model_field)) </s> remove         unique_error_message = model_field.error_messages.get('unique', None)
        if unique_error_message:
            unique_error_message = unique_error_message % {
                'model_name': model_field.model._meta.verbose_name,
                'field_label': model_field.verbose_name
            }
 </s> add 
    def test_relation_is_not_unique(self):
        RelatedModel.objects.create(user=self.instance)
        data = {'user': self.instance.pk}
        serializer = RelatedModelUserSerializer(data=data)
        assert not serializer.is_valid()
        assert serializer.errors == {'user': ['related model with this user already exists.']}

          serializer = UniquenessSerializer(data=data)
          assert not serializer.is_valid()
          assert serializer.errors == {'username': ['uniqueness model with this username already exists.']}
  
    def test_relation_is_not_unique(self):
        RelatedModel.objects.create(user=self.instance)
        data = {'user': self.instance.pk}
        serializer = RelatedModelUserSerializer(data=data)
        assert not serializer.is_valid()
        assert serializer.errors == {'user': ['related model with this user already exists.']}

      def test_is_unique(self):
          data = {'username': 'other'}
          serializer = UniquenessSerializer(data=data)
          assert serializer.is_valid()
          assert serializer.validated_data == {'username': 'other'}
  
keep keep keep add keep keep keep keep keep keep
 Respect model error_messages for relation (#7599) 
tests/test_validators.py