code: def test_err_on_categorical_asof_join_by_arg() -> None:
      df1 = pl.DataFrame(
          [
              pl.Series(
                  "cat",
                  ["a", "foo", "bar", "foo", "bar"],
                  dtype=pl.Categorical,
              ),
              pl.Series("time", [-10, 0, 10, 20, 30], dtype=pl.Int32),
          ]
      )
      df2 = pl.DataFrame(
          [
              pl.Series(
                  "cat",
                  [
                      "bar",
                      "bar",
                      "bar",
                      "bar",
                      "foo",
                      "foo",
                      "foo",
                      "foo",
                  ],
                  dtype=pl.Categorical,
              ),
              pl.Series("time", [-5, 5, 15, 25] * 2, dtype=pl.Int32),
              pl.Series("x", [1, 2, 3, 4] * 2, dtype=pl.Int32),
          ]
      )
      with pytest.raises(
          StringCacheMismatchError,
          match="cannot compare categoricals coming from different sources",
      ):
          df1.join_asof(df2, on=pl.col("time").set_sorted(), by="cat")
  
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 25 for calling a global function with example usage: test_err_on_categorical_asof_join_by_arg() without return types