code: def test_raise(self, capsys):
      from fastNLP.core.log import logger
  
      logger.set_stdout("raw")
      # 对于 nested 的情况
      collator = Collator(backend="numpy")
      data = [[1, 2], [2, 3]]
      collator.set_pad("_0")
      collator.set_pad("_0")
      print(collator(data))
      with Capturing() as out:
          collator.set_ignore("_0")
      assert "_0" in out[0]
  
      data = [{1: {2: 2, 3: 3}}]
      collator = Collator()
      collator.set_pad((1, 2))
      collator.set_pad((1, 3))
      with Capturing() as out:
          collator.set_ignore(1)
      assert "(1, 2)" in out[0] and "(1, 3)" in out[0]
      assert len(collator(data)) == 0
  
      collator = Collator()
      collator.set_ignore((1, 2))
      with pytest.raises(KeyError):
          collator.set_pad(1)
  
      collator = Collator()
      collator.set_ignore(1)
      with pytest.raises(KeyError):
          collator.set_pad((1, 2))
  
imports: import numpy
  import pytest
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH, _NEED_IMPORT_PADDLE, _NEED_IMPORT_JITTOR, _NEED_IMPORT_ONEFLOW
  from fastNLP.core.collators.collator import Collator
  from ...helpers.utils import Capturing
label_desc: Use image node_id 8 for calling the TestCollator obj's underlying member method code with example usage: obj.test_raise(capsys) without return types