code: def test_dataframe_format():
      pytest.importorskip("jinja2")
      df = pd.DataFrame(
          {
              "A": [1, 2, 3, 4, 5, 6, 7, 8],
              "B": list("ABCDEFGH"),
              "C": pd.Categorical(list("AAABBBCC")),
          }
      )
      ddf = dd.from_pandas(df, 3)
      string_dtype = _format_string_dtype()
      footer = _format_footer()
      exp = dedent(
          f"""\
          Dask DataFrame Structure:
                             A       B                C
          npartitions=3                                
          0              int64  {string_dtype}  category[known]
          3                ...     ...              ...
          6                ...     ...              ...
          7                ...     ...              ...
          {footer}"""
      )
  
      assert repr(ddf) == exp
      assert str(ddf) == exp
  
      exp = dedent(
          f"""\
                             A       B                C
          npartitions=3                                
          0              int64  {string_dtype}  category[known]
          3                ...     ...              ...
          6                ...     ...              ...
          7                ...     ...              ..."""
      )
      assert ddf.to_string() == exp
  
      exp_table = f"""<table border="1" class="dataframe">
    <thead>
      <tr style="text-align: right;">
        <th></th>
        <th>A</th>
        <th>B</th>
        <th>C</th>
      </tr>
      <tr>
        <th>npartitions=3</th>
        <th></th>
        <th></th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <th>0</th>
        <td>int64</td>
        <td>{string_dtype}</td>
        <td>category[known]</td>
      </tr>
      <tr>
        <th>3</th>
        <td>...</td>
        <td>...</td>
        <td>...</td>
      </tr>
      <tr>
        <th>6</th>
        <td>...</td>
        <td>...</td>
        <td>...</td>
      </tr>
      <tr>
        <th>7</th>
        <td>...</td>
        <td>...</td>
        <td>...</td>
      </tr>
    </tbody>
  </table>"""
  
      exp = f"""<div><strong>Dask DataFrame Structure:</strong></div>
  {exp_table}
  <div>{footer}</div>"""
      assert ddf.to_html() == exp
  
      # table is boxed with div and has style
      exp = f"""<div><strong>Dask DataFrame Structure:</strong></div>
  <div>
  {style}{exp_table}
  </div>
  <div>{footer}</div>"""
      assert ddf._repr_html_() == 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 5 for calling a global function with example usage: test_dataframe_format() without return types