code: def test_index_format():
      s = pd.Series([1, 2, 3, 4, 5, 6, 7, 8], index=list("ABCDEFGH"))
      ds = dd.from_pandas(s, 3)
      string_dtype = _format_string_dtype()
      footer = _format_footer("-index", 2)
      exp = dedent(
          f"""\
      Dask Index Structure:
      npartitions=3
      A    {string_dtype}
      D       ...
      G       ...
      H       ...
      dtype: {string_dtype}
      {footer}"""
      )
      assert repr(ds.index) == exp
      assert str(ds.index) == exp
  
      s = pd.Series(
          [1, 2, 3, 4, 5, 6, 7, 8],
          index=pd.CategoricalIndex(
              [1, 2, 3, 4, 5, 6, 7, 8], name="YYY"
          ),
      )
      ds = dd.from_pandas(s, 3)
      exp = dedent(
          """\
      Dask Index Structure:
      npartitions=3
      1    category[known]
      4                ...
      7                ...
      8                ...
      Name: YYY, dtype: category
      Dask Name: from_pandas-index, 2 graph layers"""
      )
      assert repr(ds.index) == exp
      assert str(ds.index) == exp
  
imports: from __future__ import annotations
  from textwrap import dedent
  import numpy
  import pandas
  import pytest
  import dask.array
  import dask.dataframe
  from dask.dataframe.utils import get_string_dtype, pyarrow_strings_enabled
  from dask.utils import maybe_pluralize
label_desc: Use image node_id 11 for calling a global function with example usage: test_index_format() without return types