      def test_validator_raises_error_when_abstract_method_called(self):
          validator = BaseUniqueForValidator(queryset=object(), field='foo',
                                             date_field='bar')
          with pytest.raises(NotImplementedError):
              validator.filter_queryset(attrs=None, queryset=None)
 
</s> remove         validator.instance = self.instance
        validator.filter_queryset(attrs=data, queryset=queryset)
 </s> add         validator.filter_queryset(attrs=data, queryset=queryset, instance=self.instance) </s> remove             return self.default()
 </s> add             if hasattr(self.default, 'set_context'):
                warnings.warn(
                    "Method `set_context` on defaults is deprecated and will "
                    "no longer be called starting with 3.12. Instead set "
                    "`requires_context = True` on the class, and accept the "
                    "context as an additional argument.",
                    DeprecationWarning, stacklevel=2
                )
                self.default.set_context(self)

            if getattr(self.default, 'requires_context', False):
                return self.default(serializer_field)
            else:
                return self.default()
            validator.filter_queryset(
                attrs=None, queryset=None, field_name='', date_field_name=''
            )
      def test_validator_raises_error_when_abstract_method_called(self):
          validator = BaseUniqueForValidator(queryset=object(), field='foo',
                                             date_field='bar')
          with pytest.raises(NotImplementedError):
            validator.filter_queryset(
                attrs=None, queryset=None, field_name='', date_field_name=''
            )
keep keep keep keep replace
 Drop `set_context()` (#7062)

* Do not persist the context in validators

Fixes encode/django-rest-framework#5760

* Drop set_context() in favour of 'requires_context = True' 
tests/test_validators.py