code: def test_0d_generic_special_case(self):
      class ArraySubclass(np.ndarray):
          def __float__(self):
              raise TypeError("e.g. quantities raise on this")
  
      arr = np.array(0.0)
      obj = arr.view(ArraySubclass)
      res = np.array(obj)
      # The subclass is simply cast:
      assert_array_equal(arr, res)
  
      # If the 0-D array-like is included, __float__ is currently
      # guaranteed to be used.  We may want to change that, quantities
      # and masked arrays half make use of this.
      with pytest.raises(TypeError):
          np.array([obj])
  
      # The same holds for memoryview:
      obj = memoryview(arr)
      res = np.array(obj)
      assert_array_equal(arr, res)
      with pytest.raises(ValueError):
          # The error type does not matter much here.
          np.array([obj])
  
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 TestArrayLikes obj's underlying member method code with example usage: obj.test_0d_generic_special_case() without return types