code: def test_nested_arraylikes(self, arraylike):
      # We try storing an array like into an array, but the array-like
      # will have too many dimensions.  This means the shape discovery
      # decides that the array-like must be treated as an object (a special
      # case of ragged discovery).  The result will be an array with one
      # dimension less than the maximum dimensions, and the array being
      # assigned to it (which does work for object or if `float(arraylike)`
      # works).
      initial = arraylike(np.ones((1, 1)))
  
      nested = initial
      for i in range(np.MAXDIMS - 1):
          nested = [nested]
  
      with pytest.raises(
          ValueError, match=".*would exceed the maximum"
      ):
          # It will refuse to assign the array into
          np.array(nested, dtype="float64")
  
      # If this is object, we end up assigning a (1, 1) array into (1,)
      # (due to running out of dimensions), this is currently supported but
      # a special case which is not ideal.
      arr = np.array(nested, dtype=object)
      assert arr.shape == (1,) * np.MAXDIMS
      assert arr.item() == np.array(initial).item()
  
imports: from itertools import permutations, product
  import pytest
  from pytest import param
  import numpy
  from numpy.core._rational_tests import rational
  from numpy.core._multiarray_umath import _discover_array_parameters
  from numpy.testing import assert_array_equal, assert_warns, IS_PYPY
label_desc: Use image node_id 3 for calling the TestNested obj's underlying member method code with example usage: obj.test_nested_arraylikes(arraylike) without return types