code: def test_nan_object(func):
      with warnings.catch_warnings():
          if os.name == "nt" and func in {"min", "max"}:
              # RuntimeWarning: invalid value encountered in reduce in wrapreduction
              # from NumPy.
              warnings.simplefilter("ignore", RuntimeWarning)
  
          x = np.array(
              [[1, np.nan, 3, 4], [5, 6, 7, np.nan], [9, 10, 11, 12]]
          ).astype(object)
          d = da.from_array(x, chunks=(2, 2))
  
          if func in {"nanmin", "nanmax"}:
              warnings.simplefilter("ignore", RuntimeWarning)
  
          assert_eq(
              getattr(np, func)(x, axis=()),
              getattr(da, func)(d, axis=()),
          )
  
          if func in {"nanmin", "nanmax"}:
              warnings.simplefilter("default", RuntimeWarning)
  
          if func in {"min", "max"}:
              warnings.simplefilter("ignore", RuntimeWarning)
          assert_eq(
              getattr(np, func)(x, axis=0), getattr(da, func)(d, axis=0)
          )
          if os.name != "nt" and func in {"min", "max"}:
              warnings.simplefilter("default", RuntimeWarning)
  
          assert_eq(
              getattr(np, func)(x, axis=1), getattr(da, func)(d, axis=1)
          )
          # wrap the scalar in a numpy array since the dask version cannot know dtype
          assert_eq(
              np.array(getattr(np, func)(x)).astype(object),
              getattr(da, func)(d),
          )
  
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 20 for calling a global function with example usage: test_nan_object(func) without return types