code: def test_bad_array_like_bad_length(self, error):
      # RecursionError and MemoryError are considered "critical" in
      # sequences. We could expand this more generally though. (NumPy 1.20)
      class BadSequence:
          def __len__(self):
              raise error
  
          def __getitem__(self):
              # must have getitem to be a Sequence
              return 1
  
      with pytest.raises(error):
          np.array(BadSequence())
  
imports: from itertools import permutations, product
  import pytest
  from pytest import param
  import numpy
  import numpy._core._multiarray_umath
  from numpy._core._rational_tests import rational
  from numpy.testing import assert_array_equal, assert_warns, IS_PYPY
label_desc: Use image node_id 7 for calling the TestArrayLikes obj's underlying member method code with example usage: obj.test_bad_array_like_bad_length(error) and returns: int