code: def test_categorical_outer_join() -> None:
      df1 = pl.DataFrame(
          [
              pl.Series("key1", [42]),
              pl.Series("key2", ["bar"], dtype=pl.Categorical),
              pl.Series("val1", [1]),
          ]
      ).lazy()
  
      df2 = pl.DataFrame(
          [
              pl.Series("key1", [42]),
              pl.Series("key2", ["bar"], dtype=pl.Categorical),
              pl.Series("val2", [2]),
          ]
      ).lazy()
  
      expected = pl.DataFrame(
          {
              "key1": [42],
              "key2": ["bar"],
              "val1": [1],
              "key1_right": [42],
              "key2_right": ["bar"],
              "val2": [2],
          },
          schema_overrides={
              "key2": pl.Categorical,
              "key2_right": pl.Categorical,
          },
      )
  
      out = df1.join(df2, on=["key1", "key2"], how="outer").collect()
      assert_frame_equal(out, expected)
  
      dfa = pl.DataFrame(
          [
              pl.Series("key", ["foo", "bar"], dtype=pl.Categorical),
              pl.Series("val1", [3, 1]),
          ]
      )
      dfb = pl.DataFrame(
          [
              pl.Series("key", ["bar", "baz"], dtype=pl.Categorical),
              pl.Series("val2", [6, 8]),
          ]
      )
  
      df = dfa.join(dfb, on="key", how="outer")
      # the cast is important to test the rev map
      assert df["key"].cast(pl.String).to_list() == ["bar", None, "foo"]
      assert df["key_right"].cast(pl.String).to_list() == [
          "bar",
          "baz",
          None,
      ]
  
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 1 for calling a global function with example usage: test_categorical_outer_join() without return types