code: def test_sort_categorical_retain_none(
      context: contextlib.AbstractContextManager,  # type: ignore[type-arg]
      ordering: Literal["physical", "lexical"],
  ) -> None:
      with context:
          df = pl.DataFrame(
              [
                  pl.Series(
                      "e",
                      ["foo", None, "bar", "ham", None],
                      dtype=pl.Categorical(ordering=ordering),
                  )
              ]
          )
  
          df_sorted = df.with_columns(pl.col("e").sort())
          assert (
              df_sorted.get_column("e").null_count()
              == df.get_column("e").null_count()
              == 2
          )
          if ordering == "lexical":
              assert df_sorted.get_column("e").to_list() == [
                  None,
                  None,
                  "bar",
                  "foo",
                  "ham",
              ]
  
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 44 for calling a global function with example usage: test_sort_categorical_retain_none(context, ordering) without return types