code: def test_reductions_non_numeric_dtypes():
      # test non-numric blocks
  
      def check_raises(d, p, func):
          pytest.raises(
              (TypeError, ValueError),
              lambda: getattr(d, func)().compute(),
          )
          pytest.raises(
              (TypeError, ValueError), lambda: getattr(p, func)()
          )
  
      pds = pd.Series(["a", "b", "c", "d", "e"])
      dds = dd.from_pandas(pds, 2)
      assert_eq(dds.sum(), pds.sum())
      check_raises(dds, pds, "prod")
      check_raises(dds, pds, "product")
      assert_eq(dds.min(), pds.min())
      assert_eq(dds.max(), pds.max())
      assert_eq(dds.count(), pds.count())
      check_raises(dds, pds, "std")
      check_raises(dds, pds, "var")
      check_raises(dds, pds, "sem")
      check_raises(dds, pds, "skew")
      check_raises(dds, pds, "kurtosis")
      assert_eq(dds.nunique(), pds.nunique())
  
      for pds in [
          pd.Series(pd.Categorical([1, 2, 3, 4, 5], ordered=True)),
          pd.Series(pd.Categorical(list("abcde"), ordered=True)),
          pd.Series(pd.date_range("2011-01-01", freq="D", periods=5)),
      ]:
          dds = dd.from_pandas(pds, 2)
  
          check_raises(dds, pds, "sum")
          check_raises(dds, pds, "prod")
          check_raises(dds, pds, "product")
          assert_eq(dds.min(), pds.min())
          assert_eq(dds.max(), pds.max())
          assert_eq(dds.count(), pds.count())
          if pds.dtype != "datetime64[ns]":
              # std is implemented for datetimes in pandas 1.2.0, but dask
              # implementation depends on var which isn't
              check_raises(dds, pds, "std")
          check_raises(dds, pds, "var")
          check_raises(dds, pds, "sem")
          check_raises(dds, pds, "skew")
          check_raises(dds, pds, "kurtosis")
          assert_eq(dds.nunique(), pds.nunique())
  
      pds = pd.Series(pd.timedelta_range("1 days", freq="D", periods=5))
      dds = dd.from_pandas(pds, 2)
      assert_eq(dds.sum(), pds.sum())
      assert_eq(dds.min(), pds.min())
      assert_eq(dds.max(), pds.max())
      assert_eq(dds.count(), pds.count())
      # both pandas and dask skew calculations do not support timedelta
      check_raises(dds, pds, "skew")
      check_raises(dds, pds, "kurtosis")
  
      # ToDo: pandas supports timedelta std, dask returns float64
      # assert_eq(dds.std(), pds.std())
  
      # ToDo: pandas supports timedelta std, otherwise dask raises:
      # TypeError: unsupported operand type(s) for *: 'float' and 'Timedelta'
      # assert_eq(dds.mean(), pds.mean())
  
      assert_eq(dds.nunique(), pds.nunique())
  
imports: from __future__ import annotations
  import contextlib
  import warnings
  from datetime import datetime
  import numpy
  import pandas
  import pytest
  from pandas.api.types import is_scalar
  import dask.dataframe
  from dask.array.numpy_compat import _numpy_125
  from dask.dataframe._compat import PANDAS_GE_140, PANDAS_GE_150, PANDAS_GE_200, PANDAS_VERSION, check_numeric_only_deprecation
  from dask.dataframe.utils import assert_dask_graph, assert_eq, make_meta, pyarrow_strings_enabled
label_desc: Use image node_id 16 for calling a global function with example usage: test_reductions_non_numeric_dtypes() without return types