code: def test_einsum_object_errors(self):
      # Exceptions created by object arithmetic should
      # successfully propagate
  
      class CustomException(Exception):
          pass
  
      class DestructoBox:
          def __init__(self, value, destruct):
              self._val = value
              self._destruct = destruct
  
          def __add__(self, other):
              tmp = self._val + other._val
              if tmp >= self._destruct:
                  raise CustomException
              else:
                  self._val = tmp
                  return self
  
          def __radd__(self, other):
              if other == 0:
                  return self
              else:
                  return self.__add__(other)
  
          def __mul__(self, other):
              tmp = self._val * other._val
              if tmp >= self._destruct:
                  raise CustomException
              else:
                  self._val = tmp
                  return self
  
          def __rmul__(self, other):
              if other == 0:
                  return self
              else:
                  return self.__mul__(other)
  
      a = np.array(
          [DestructoBox(i, 5) for i in range(1, 10)], dtype="object"
      ).reshape(3, 3)
  
      # raised from unbuffered_loop_nop1_ndim2
      assert_raises(CustomException, np.einsum, "ij->i", a)
  
      # raised from unbuffered_loop_nop1_ndim3
      b = np.array(
          [DestructoBox(i, 100) for i in range(0, 27)], dtype="object"
      ).reshape(3, 3, 3)
      assert_raises(CustomException, np.einsum, "i...k->...", b)
  
      # raised from unbuffered_loop_nop2_ndim2
      b = np.array(
          [DestructoBox(i, 55) for i in range(1, 4)], dtype="object"
      )
      assert_raises(CustomException, np.einsum, "ij, j", a, b)
  
      # raised from unbuffered_loop_nop2_ndim3
      assert_raises(CustomException, np.einsum, "ij, jh", a, a)
  
      # raised from PyArray_EinsteinSum
      assert_raises(CustomException, np.einsum, "ij->", a)
  
imports: import itertools
  import sys
  import platform
  import pytest
  import numpy
  from numpy.testing import assert_, assert_equal, assert_array_equal, assert_almost_equal, assert_raises, suppress_warnings, assert_raises_regex, assert_allclose
label_desc: Use image node_id 3 for calling the TestEinsum obj's underlying member method code with example usage: obj.test_einsum_object_errors() and returns: self, self, self, self, self, self