class_docstr: Test deprecator class creation with custom warnings and errors
class_docstr_tok: ["Test","deprecator","class","creation","with","custom","warnings","and","errors"]
code: def test_deprecator_maker(self):
      dec = self.dep_maker(warn_class=UserWarning)
      func = dec("foo")(func_no_doc)
      with pytest.warns(UserWarning) as w:
          # warnings.simplefilter('always')
          assert func() is None
          assert len(w) == 1
  
      dec = self.dep_maker(error_class=CustomError)
      func = dec("foo")(func_no_doc)
      with pytest.deprecated_call():
          assert func() is None
  
      func = dec("foo", until="1.8")(func_no_doc)
      with pytest.raises(CustomError):
          func()
  
file_path: nibabel/nibabel/tests/test_deprecator.py
imports: import sys
  import warnings
  from functools import partial
  from textwrap import indent
  import pytest
  from nibabel.deprecator import TESTCLEANUP, TESTSETUP, Deprecator, ExpiredDeprecationError, _add_dep_doc, _ensure_cr
  from ..testing import clear_and_catch_warnings
label_desc: Use image node_id 1 for calling the TestDeprecatorMaker obj's underlying member method code with example usage: obj.test_deprecator_maker() without return types