code: def test_reductions_frame_dtypes_numeric_only_supported(func):
      df = pd.DataFrame(
          {
              "int": [1, 2, 3, 4, 5, 6, 7, 8],
              "float": [1.0, 2.0, 3.0, 4.0, np.nan, 6.0, 7.0, 8.0],
              "dt": [pd.NaT]
              + [datetime(2011, i, 1) for i in range(1, 8)],
              "str": list("abcdefgh"),
              "timedelta": pd.to_timedelta(
                  [1, 2, 3, 4, 5, 6, 7, np.nan]
              ),
              "bool": [True, False] * 4,
          }
      )
      npartitions = 3
      if func == "quantile":
          # bool doesn't work in pandas quantile
          df = df.drop(columns="bool")
          npartitions = 1  # https://github.com/dask/dask/issues/9227
  
      ddf = dd.from_pandas(df, npartitions)
  
      numeric_only_false_raises = [
          "sum",
          "prod",
          "product",
          "std",
          "var",
          "quantile",
      ]
  
      # `numeric_only=True` is always supported
      assert_eq(
          getattr(df, func)(numeric_only=True),
          getattr(ddf, func)(numeric_only=True),
      )
      errors = (
          (ValueError, TypeError)
          if pa is None
          else (ValueError, TypeError, ArrowNotImplementedError)
      )
  
      # `numeric_only=False`
      if func in numeric_only_false_raises:
          with pytest.raises(
              errors,
              match="'DatetimeArray' with dtype datetime64.*|"
              "'DatetimeArray' does not implement reduction|could not convert|"
              "'ArrowStringArray' with dtype string"
              "|unsupported operand|no kernel|not supported",
          ):
              getattr(ddf, func)(numeric_only=False)
  
          warning = FutureWarning
      else:
          assert_eq(
              getattr(df, func)(numeric_only=False),
              getattr(ddf, func)(numeric_only=False),
          )
          warning = None
  
      # `numeric_only` default value
      if PANDAS_GE_200:
          if func in numeric_only_false_raises:
              with pytest.raises(
                  errors,
                  match="'DatetimeArray' with dtype datetime64.*|"
                  "'DatetimeArray' does not implement reduction|could not convert|"
                  "'ArrowStringArray' with dtype string"
                  "|unsupported operand|no kernel|not supported",
              ):
                  getattr(ddf, func)()
          else:
              assert_eq(
                  getattr(df, func)(),
                  getattr(ddf, func)(),
              )
      elif PANDAS_GE_150:
          with pytest.warns(
              warning, match="The default value of numeric_only"
          ):
              pd_result = getattr(df, func)()
          with pytest.warns(
              warning, match="The default value of numeric_only"
          ):
              dd_result = getattr(ddf, func)()
          assert_eq(pd_result, dd_result)
      else:
          if func in ["std", "var", "quantile"]:
              warning = None
          with pytest.warns(warning, match="Dropping of nuisance"):
              pd_result = getattr(df, func)()
          with pytest.warns(warning, match="Dropping of nuisance"):
              dd_result = getattr(ddf, func)()
          assert_eq(pd_result, dd_result)
  
      num_cols = ["int", "float"]
      if func != "quantile":
          num_cols.append("bool")
  
      df_numerics = df[num_cols]
      ddf_numerics = ddf[num_cols]
  
      assert_eq(
          getattr(df_numerics, func)(),
          getattr(ddf_numerics, func)(),
      )
      assert_eq(
          getattr(df_numerics, func)(numeric_only=False),
          getattr(ddf_numerics, func)(numeric_only=False),
      )
  
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 20 for calling a global function with example usage: test_reductions_frame_dtypes_numeric_only_supported(func) without return types