code: def test_nanarg_reductions(dfunc, func):
      x = np.random.default_rng().random((10, 10, 10))
      x[5] = np.nan
      a = da.from_array(x, chunks=(3, 4, 5))
      assert_eq(dfunc(a), func(x))
      assert_eq(dfunc(a, 0), func(x, 0))
      with warnings.catch_warnings():
          warnings.simplefilter(
              "ignore", RuntimeWarning
          )  # All-NaN slice encountered
          with pytest.raises(ValueError):
              dfunc(a, 1).compute()
  
          with pytest.raises(ValueError):
              dfunc(a, 2).compute()
  
          x[:] = np.nan
          a = da.from_array(x, chunks=(3, 4, 5))
          with pytest.raises(ValueError):
              dfunc(a).compute()
  
imports: from __future__ import annotations
  import os
  import warnings
  from contextlib import nullcontext
  from itertools import permutations, zip_longest
  import pytest
  import itertools
  import dask.array
  import dask.config
  from dask.array.numpy_compat import ComplexWarning, _numpy_122
  from dask.array.utils import assert_eq, same_keys
  from dask.core import get_deps
label_desc: Use image node_id 11 for calling a global function with example usage: test_nanarg_reductions(dfunc, func) without return types