code: def test_polars_adapter():
      """Check Polars adapter has expected behavior."""
      pl = pytest.importorskip("polars")
      X_np = np.array([[1, 0, 3], [0, 0, 1]])
      columns = ["f1", "f2", "f3"]
      X_df_orig = pl.DataFrame(X_np, schema=columns, orient="row")
  
      adapter = ADAPTERS_MANAGER.adapters["polars"]
      X_container = adapter.create_container(
          X_np, X_df_orig, columns=lambda: columns
      )
  
      assert isinstance(X_container, pl.DataFrame)
      assert_array_equal(X_container.columns, columns)
  
      # Update columns with create_container
      new_columns = np.asarray(["a", "b", "c"], dtype=object)
      new_df = adapter.create_container(
          X_df_orig, X_df_orig, columns=new_columns
      )
      assert_array_equal(new_df.columns, new_columns)
  
      assert adapter.is_supported_container(X_df_orig)
      assert not adapter.is_supported_container(X_np)
  
      # adapter.update_columns updates the columns
      new_columns = np.array(["a", "c", "g"], dtype=object)
      new_df = adapter.rename_columns(X_df_orig, new_columns)
      assert_array_equal(new_df.columns, new_columns)
  
      # adapter.hstack stacks the dataframes horizontally.
      X_df_1 = pl.DataFrame(
          [[1, 2, 5], [3, 4, 6]], schema=["a", "b", "e"], orient="row"
      )
      X_df_2 = pl.DataFrame([[4], [5]], schema=["c"], orient="row")
      X_stacked = adapter.hstack([X_df_1, X_df_2])
  
      expected_df = pl.DataFrame(
          [[1, 2, 5, 4], [3, 4, 6, 5]],
          schema=["a", "b", "e", "c"],
          orient="row",
      )
      from polars.testing import assert_frame_equal
  
      assert_frame_equal(X_stacked, expected_df)
  
imports: import importlib
  from collections import namedtuple
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from sklearn._config import config_context, get_config
  from sklearn.preprocessing import StandardScaler
  from sklearn.utils._set_output import ADAPTERS_MANAGER, ContainerAdapterProtocol, _get_output_config, _safe_set_output, _SetOutputMixin, _wrap_data_with_container, check_library_installed
  from sklearn.utils.fixes import CSR_CONTAINERS
label_desc: Use image node_id 2 for calling a global function with example usage: test_polars_adapter() without return types