code: def test_stringcache() -> None:
      N = 1_500
      with pl.StringCache():
          # create a large enough column that the categorical map is reallocated
          df = pl.DataFrame(
              {"cats": pl.arange(0, N, eager=True)}
          ).select(
              [pl.col("cats").cast(pl.String).cast(pl.Categorical)]
          )
          assert df.filter(pl.col("cats").is_in(["1", "2"])).to_dict(
              as_series=False
          ) == {"cats": ["1", "2"]}
  
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 22 for calling a global function with example usage: test_stringcache() without return types