code: def test_einsum_errors(self, do_opt, einsum_fn):
      # Need enough arguments
      assert_raises(ValueError, einsum_fn, optimize=do_opt)
      assert_raises(ValueError, einsum_fn, "", optimize=do_opt)
  
      # subscripts must be a string
      assert_raises(TypeError, einsum_fn, 0, 0, optimize=do_opt)
  
      # issue 4528 revealed a segfault with this call
      assert_raises(
          TypeError, einsum_fn, *(None,) * 63, optimize=do_opt
      )
  
      # number of operands must match count in subscripts string
      assert_raises(ValueError, einsum_fn, "", 0, 0, optimize=do_opt)
      assert_raises(
          ValueError, einsum_fn, ",", 0, [0], [0], optimize=do_opt
      )
      assert_raises(ValueError, einsum_fn, ",", [0], optimize=do_opt)
  
      # can't have more subscripts than dimensions in the operand
      assert_raises(ValueError, einsum_fn, "i", 0, optimize=do_opt)
      assert_raises(
          ValueError, einsum_fn, "ij", [0, 0], optimize=do_opt
      )
      assert_raises(ValueError, einsum_fn, "...i", 0, optimize=do_opt)
      assert_raises(
          ValueError, einsum_fn, "i...j", [0, 0], optimize=do_opt
      )
      assert_raises(ValueError, einsum_fn, "i...", 0, optimize=do_opt)
      assert_raises(
          ValueError, einsum_fn, "ij...", [0, 0], optimize=do_opt
      )
  
      # invalid ellipsis
      assert_raises(
          ValueError, einsum_fn, "i..", [0, 0], optimize=do_opt
      )
      assert_raises(
          ValueError, einsum_fn, ".i...", [0, 0], optimize=do_opt
      )
      assert_raises(
          ValueError, einsum_fn, "j->..j", [0, 0], optimize=do_opt
      )
      assert_raises(
          ValueError, einsum_fn, "j->.j...", [0, 0], optimize=do_opt
      )
  
      # invalid subscript character
      assert_raises(
          ValueError, einsum_fn, "i%...", [0, 0], optimize=do_opt
      )
      assert_raises(
          ValueError, einsum_fn, "...j$", [0, 0], optimize=do_opt
      )
      assert_raises(
          ValueError, einsum_fn, "i->&", [0, 0], optimize=do_opt
      )
  
      # output subscripts must appear in input
      assert_raises(
          ValueError, einsum_fn, "i->ij", [0, 0], optimize=do_opt
      )
  
      # output subscripts may only be specified once
      assert_raises(
          ValueError,
          einsum_fn,
          "ij->jij",
          [[0, 0], [0, 0]],
          optimize=do_opt,
      )
  
      # dimensions must match when being collapsed
      assert_raises(
          ValueError,
          einsum_fn,
          "ii",
          np.arange(6).reshape(2, 3),
          optimize=do_opt,
      )
      assert_raises(
          ValueError,
          einsum_fn,
          "ii->i",
          np.arange(6).reshape(2, 3),
          optimize=do_opt,
      )
  
      with assert_raises_regex(ValueError, "'b'"):
          # gh-11221 - 'c' erroneously appeared in the error message
          a = np.ones((3, 3, 4, 5, 6))
          b = np.ones((3, 4, 5))
          einsum_fn("aabcb,abc", a, b)
  
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 1 for calling the TestEinsum obj's underlying member method code with example usage: obj.test_einsum_errors(do_opt, einsum_fn) without return types