code: def test_make_meta():
      df = pd.DataFrame(
          {"a": [1, 2, 3], "b": list("abc"), "c": [1.0, 2.0, 3.0]},
          index=[10, 20, 30],
      )
  
      # Pandas dataframe
      meta = make_meta(df)
      assert len(meta) == 0
      assert (meta.dtypes == df.dtypes).all()
      assert isinstance(meta.index, type(df.index))
      # - ensure no references to original data arrays are kept
      for col in "abc":
          meta_pointer = meta[col].values.__array_interface__["data"][0]
          df_pointer = df[col].values.__array_interface__["data"][0]
          assert meta_pointer != df_pointer
      meta_pointer = meta.index.values.__array_interface__["data"][0]
      df_pointer = df.index.values.__array_interface__["data"][0]
      assert meta_pointer != df_pointer
  
      # Pandas series
      meta = make_meta(df.a)
      assert len(meta) == 0
      assert meta.dtype == df.a.dtype
      assert isinstance(meta.index, type(df.index))
      # - ensure no references to original data arrays are kept
      meta_pointer = meta.values.__array_interface__["data"][0]
      df_pointer = df.a.values.__array_interface__["data"][0]
      assert meta_pointer != df_pointer
      meta_pointer = meta.index.values.__array_interface__["data"][0]
      df_pointer = df.index.values.__array_interface__["data"][0]
      assert meta_pointer != df_pointer
  
      # Pandas index
      meta = make_meta(df.index)
      assert isinstance(meta, type(df.index))
      assert len(meta) == 0
      # - ensure no references to original data arrays are kept
      meta_pointer = meta.values.__array_interface__["data"][0]
      df_pointer = df.index.values.__array_interface__["data"][0]
      assert meta_pointer != df_pointer
  
      # Dask object
      ddf = dd.from_pandas(df, npartitions=2)
      assert make_meta(ddf) is ddf._meta
  
      # Dict
      meta = make_meta({"a": "i8", "b": "O", "c": "f8"})
      assert isinstance(meta, pd.DataFrame)
      assert len(meta) == 0
      assert (meta.dtypes == df.dtypes).all()
      assert isinstance(meta.index, pd.RangeIndex)
  
      # List
      meta = make_meta([("a", "i8"), ("c", "f8"), ("b", "O")])
      assert (meta.columns == ["a", "c", "b"]).all()
      assert len(meta) == 0
      assert (meta.dtypes == df.dtypes[meta.dtypes.index]).all()
      assert isinstance(meta.index, pd.RangeIndex)
  
      # Tuple
      meta = make_meta(("a", "i8"))
      assert isinstance(meta, pd.Series)
      assert len(meta) == 0
      assert meta.dtype == "i8"
      assert meta.name == "a"
  
      # Iterable
      class CustomMetadata(Iterable):
          """Custom class iterator returning pandas types."""
  
          def __init__(self, max=0):
              self.types = [("a", "i8"), ("c", "f8"), ("b", "O")]
  
          def __iter__(self):
              self.n = 0
              return self
  
          def __next__(self):
              if self.n < len(self.types):
                  ret = self.types[self.n]
                  self.n += 1
                  return ret
              else:
                  raise StopIteration
  
      meta = make_meta(CustomMetadata())
      assert (meta.columns == ["a", "c", "b"]).all()
      assert len(meta) == 0
      assert (meta.dtypes == df.dtypes[meta.dtypes.index]).all()
      assert isinstance(meta.index, pd.RangeIndex)
  
      # With index
      idx = pd.Index([1, 2], name="foo")
      meta = make_meta(
          {"a": "i8", "b": "i4"},
          index=idx,
      )
      assert type(meta.index) is type(idx)
      assert meta.index.dtype == "int64"
      assert len(meta.index) == 0
  
      meta = make_meta(("a", "i8"), index=idx)
      assert type(meta.index) is type(idx)
      assert meta.index.dtype == "int64"
      assert len(meta.index) == 0
  
      # Categoricals
      meta = make_meta({"a": "category"}, parent_meta=df)
      assert len(meta.a.cat.categories) == 1
      assert meta.a.cat.categories[0] == UNKNOWN_CATEGORIES
      meta = make_meta(("a", "category"), parent_meta=df)
      assert len(meta.cat.categories) == 1
      assert meta.cat.categories[0] == UNKNOWN_CATEGORIES
  
      # Categorials with Index
      meta = make_meta({"a": "category", "b": "int64"}, index=idx)
      assert len(meta.a.cat.categories) == 1
      assert meta.index.dtype == "int64"
      assert meta.index.empty
  
      # Numpy scalar
      meta = make_meta(np.float64(1.0), parent_meta=df)
      assert isinstance(meta, np.float64)
  
      # Python scalar
      meta = make_meta(1.0, parent_meta=df)
      assert isinstance(meta, np.float64)
  
      # Timestamp
      x = pd.Timestamp(2000, 1, 1)
      meta = make_meta(x, parent_meta=df)
      assert meta is x
  
      # DatetimeTZDtype
      x = pd.DatetimeTZDtype(tz="UTC")
      meta = make_meta(x)
      assert meta == pd.Timestamp(1, tz=x.tz, unit=x.unit)
  
      # Dtype expressions
      meta = make_meta("i8", parent_meta=df)
      assert isinstance(meta, np.int64)
      meta = make_meta(float, parent_meta=df)
      assert isinstance(meta, np.dtype(float).type)
      meta = make_meta(np.dtype("bool"), parent_meta=df)
      assert isinstance(meta, np.bool_)
      assert pytest.raises(TypeError, lambda: make_meta(None))
  
imports: from __future__ import annotations
  import re
  import warnings
  from collections.abc import Iterable
  import numpy
  import pandas
  import pytest
  from packaging.version import Version
  import dask
  import dask.dataframe
  from dask.dataframe._compat import PANDAS_GE_200, tm
  from dask.dataframe.core import apply_and_enforce
  from dask.dataframe.utils import UNKNOWN_CATEGORIES, assert_eq, check_matching_columns, check_meta, is_dataframe_like, is_index_like, is_series_like, make_meta, meta_frame_constructor, meta_nonempty, meta_series_constructor, pyarrow_strings_enabled, raise_on_meta_error, shard_df_on_index, valid_divisions
  from dask.local import get_sync
label_desc: Use image node_id 2 for calling a global function with example usage: test_make_meta() and returns: self, ret