code: def test_categorical_round_trip() -> None:
      df = pl.DataFrame({"ints": [1, 2, 3], "cat": ["a", "b", "c"]})
      df = df.with_columns(pl.col("cat").cast(pl.Categorical))
  
      tbl = df.to_arrow()
      assert "dictionary" in str(tbl["cat"].type)
  
      df2 = cast(pl.DataFrame, pl.from_arrow(tbl))
      assert df2.dtypes == [pl.Int64, pl.Categorical]
  
file_path: polars/py-polars/tests/unit/io/test_other.py
imports: from __future__ import annotations
  import copy
  import sys
  from pathlib import Path
  from typing import Any, Callable, cast
  import pytest
  import polars
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 5 for calling a global function with example usage: test_categorical_round_trip() without return types