code: def test_nested_categorical_cast() -> None:
      values = [["x"], ["y"], ["x"]]
      dtype = pl.List(pl.Categorical)
      s = pl.Series(values).cast(dtype)
      assert s.dtype == dtype
      assert s.to_list() == values
  
imports: from __future__ import annotations
  import contextlib
  import io
  import operator
  from typing import TYPE_CHECKING, Any, Callable, Literal
  import pytest
  import polars
  from polars import StringCache
  from polars.exceptions import CategoricalRemappingWarning, StringCacheMismatchError
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 28 for calling a global function with example usage: test_nested_categorical_cast() without return types