code: def test_validate_array(
      name,
      copy,
      as_any,
      to_list,
      to_tuple,
      dtype_out,
      case,
      stack_input,
      input_type,
  ):
      # Set up
      valid_array = np.array(case.valid_array)
      invalid_array = np.array(case.invalid_array)
  
      # Inputs may be scalar, use stacking to ensure we have test cases
      # with multidimensional arrays
      if stack_input:
          valid_array = np.stack((valid_array, valid_array), axis=0)
          valid_array = np.stack((valid_array, valid_array), axis=1)
          invalid_array = np.stack(
              (invalid_array, invalid_array), axis=0
          )
          invalid_array = np.stack(
              (invalid_array, invalid_array), axis=1
          )
  
      if input_type is tuple:
          valid_array = cast_to_tuple_array(valid_array)
          invalid_array = cast_to_tuple_array(invalid_array)
      elif input_type is list:
          valid_array = valid_array.tolist()
          invalid_array = invalid_array.tolist()
      elif input_type is np.ndarray:
          valid_array = np.asarray(valid_array)
          invalid_array = np.asarray(invalid_array)
      else:  # pyvista_ndarray:
          valid_array = pyvista_ndarray(valid_array)
          invalid_array = pyvista_ndarray(invalid_array)
  
      shape = np.array(valid_array).shape
      common_kwargs = dict(
          **case.kwarg,
          name=name,
          copy=copy,
          as_any=as_any,
          to_list=to_list,
          to_tuple=to_tuple,
          must_have_dtype=np.number,
          dtype_out=dtype_out,
          must_have_length=range(np.array(valid_array).size + 1),
          must_have_min_length=1,
          must_have_max_length=np.array(valid_array).size,
          must_have_shape=shape,
          reshape_to=shape,
          broadcast_to=shape,
          must_be_in_range=(np.min(valid_array), np.max(valid_array)),
          must_be_nonnegative=np.all(np.array(valid_array) > 0),
      )
  
      # Test raises correct error with invalid input
      with pytest.raises(case.error_type, match=case.error_msg):
          validate_array(invalid_array, **common_kwargs)
      # Test error has correct name
      with pytest.raises(case.error_type, match=name):
          validate_array(invalid_array, **common_kwargs)
  
      # Test no error with valid input
      array_in = valid_array
      array_out = validate_array(array_in, **common_kwargs)
      assert np.array_equal(array_out, array_in)
  
      # Check output
      if np.array(array_in).ndim == 0 and (to_tuple or to_list):
          # test scalar input results in scalar output
          assert isinstance(array_out, float) or isinstance(
              array_out, int
          )
      elif to_tuple:
          assert type(array_out) is tuple
      elif to_list:
          assert isinstance(array_out, list)
      else:
          assert isinstance(array_out, np.ndarray)
          assert array_out.dtype.type is dtype_out
          if as_any:
              if input_type is pyvista_ndarray:
                  assert type(array_out) is pyvista_ndarray
              elif input_type is np.ndarray:
                  assert type(array_out) is np.ndarray
              if (
                  not copy
                  and isinstance(array_in, np.ndarray)
                  and validate_dtype(dtype_out) is array_in.dtype
              ):
                  assert array_out is array_in
              else:
                  assert array_out is not array_in
          else:
              assert type(array_out) is np.ndarray
  
      if copy:
          assert array_out is not array_in
  
imports: from collections import namedtuple
  from re import escape
  import sys
  from typing import Union, get_args, get_origin
  import numpy
  import pytest
  from vtk import vtkTransform
  from pyvista.core import pyvista_ndarray
  from pyvista.core.input_validation.check import _validate_shape_value, check_has_length, check_has_shape, check_is_arraylike, check_is_dtypelike, check_is_finite, check_is_greater_than, check_is_in_range, check_is_instance, check_is_integerlike, check_is_iterable, check_is_iterable_of_some_type, check_is_iterable_of_strings, check_is_less_than, check_is_nonnegative, check_is_number, check_is_real, check_is_scalar, check_is_sequence, check_is_sorted, check_is_string, check_is_string_in_iterable, check_is_subdtype, check_is_type
  from pyvista.core.input_validation.validate import _set_default_kwarg_mandatory, validate_array, validate_array3, validate_arrayN, validate_arrayN_uintlike, validate_arrayNx3, validate_axes, validate_data_range, validate_dtype, validate_number, validate_transform3x3, validate_transform4x4
  from pyvista.core.utilities.arrays import cast_to_tuple_array, vtkmatrix_from_array
label_desc: Use image node_id 20 for calling a global function with example usage: test_validate_array(name, copy, as_any, to_list, to_tuple, dtype_out, case, stack_input, input_type) without return types