code: def test_cast_null_to_categorical() -> None:
      assert pl.DataFrame().with_columns(
          [pl.lit(None).cast(pl.Categorical).alias("nullable_enum")]
      ).dtypes == [pl.Categorical]
  
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 17 for calling a global function with example usage: test_cast_null_to_categorical() without return types