code: def test_numel(dtype, keepdims, nan):
      x = np.ones((2, 3, 4))
      if nan:
          y = np.random.default_rng().uniform(-1, 1, size=(2, 3, 4))
          x[y < 0] = np.nan
          numel = da.reductions.nannumel
  
          def _sum(arr, **kwargs):
              n = np.sum(
                  np.ma.masked_where(np.isnan(arr), arr), **kwargs
              )
              return (
                  n.filled(0) if isinstance(n, np.ma.MaskedArray) else n
              )
  
      else:
          numel = da.reductions.numel
          _sum = np.sum
  
      assert_eq(
          numel(x, axis=(), keepdims=keepdims, dtype=dtype),
          _sum(x, axis=(), keepdims=keepdims, dtype=dtype),
      )
      assert_eq(
          numel(x, axis=0, keepdims=keepdims, dtype=dtype),
          _sum(x, axis=0, keepdims=keepdims, dtype=dtype),
      )
  
      for length in range(x.ndim):
          for sub in itertools.combinations(
              [d for d in range(x.ndim)], length
          ):
              assert_eq(
                  numel(x, axis=sub, keepdims=keepdims, dtype=dtype),
                  _sum(x, axis=sub, keepdims=keepdims, dtype=dtype),
              )
  
      for length in range(x.ndim):
          for sub in itertools.combinations(
              [d for d in range(x.ndim)], length
          ):
              ssub = np.random.default_rng().shuffle(list(sub))
              assert_eq(
                  numel(x, axis=ssub, keepdims=keepdims, dtype=dtype),
                  _sum(x, axis=ssub, keepdims=keepdims, dtype=dtype),
              )
  
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 1 for calling a global function with example usage: test_numel(dtype, keepdims, nan) and returns: unknown