code: def _check_setitem_invalid(self, arr, invalid):
      msg = f"Invalid value '{invalid!s}' for dtype {arr.dtype}"
      msg = re.escape(msg)
      with pytest.raises(TypeError, match=msg):
          arr[0] = invalid
  
      with pytest.raises(TypeError, match=msg):
          arr[:] = invalid
  
      with pytest.raises(TypeError, match=msg):
          arr[[0]] = invalid
  
      # FIXME: don't leave commented-out
      # with pytest.raises(TypeError):
      #    arr[[0]] = [invalid]
  
      # with pytest.raises(TypeError):
      #    arr[[0]] = np.array([invalid], dtype=object)
  
      # Series non-coercion, behavior subject to change
      ser = pd.Series(arr)
      with pytest.raises(TypeError, match=msg):
          ser[0] = invalid
  
file_path: pandas/pandas/tests/arrays/masked/test_indexing.py
imports: import re
  import numpy
  import pytest
  import pandas
label_desc: Use image node_id 1 for calling the TestSetitemValidation obj's underlying member method code with example usage: obj._check_setitem_invalid(arr, invalid) without return types