code: def test_categorical_set_index_npartitions_vs_ncategories(
      npartitions, ncategories
  ):
      """https://github.com/dask/dask/issues/5343"""
      rows_per_category = 10
      n_rows = ncategories * rows_per_category
  
      categories = ["CAT" + str(i) for i in range(ncategories)]
      pdf = pd.DataFrame(
          {
              "id": categories * rows_per_category,
              "value": np.random.random(n_rows),
          }
      )
      ddf = dd.from_pandas(pdf, npartitions=npartitions)
      ddf["id"] = ddf["id"].astype("category").cat.as_ordered()
      ddf = ddf.set_index("id")
  
imports: from __future__ import annotations
  import contextlib
  import operator
  import warnings
  import numpy
  import pandas
  import pytest
  import dask
  import dask.dataframe
  from dask.dataframe import _compat
  from dask.dataframe._compat import PANDAS_GE_150, PANDAS_GE_200, PANDAS_GE_210, tm
  from dask.dataframe._pyarrow import to_pyarrow_string
  from dask.dataframe.core import _concat
  from dask.dataframe.utils import assert_eq, clear_known_categories, get_string_dtype, make_meta, pyarrow_strings_enabled
label_desc: Use image node_id 7 for calling a global function with example usage: test_categorical_set_index_npartitions_vs_ncategories(npartitions, ncategories) without return types