code: def test_opaque_filter_on_lists_3784() -> None:
      df = pl.DataFrame(
          {"str": ["A", "B", "A", "B", "C"], "group": [1, 1, 2, 1, 2]}
      ).lazy()
      df = df.with_columns(pl.col("str").cast(pl.Categorical))
  
      df_groups = df.group_by("group").agg(
          [pl.col("str").alias("str_list")]
      )
  
      pre = "A"
      succ = "B"
  
      assert (
          df_groups.filter(
              pl.col("str_list").map_elements(
                  lambda variant: pre in variant
                  and succ in variant
                  and variant.to_list().index(pre)
                  < variant.to_list().index(succ)
              )
          )
      ).collect().to_dict(as_series=False) == {
          "group": [1],
          "str_list": [["A", "B", "B"]],
      }
  
imports: from __future__ import annotations
  from datetime import datetime, timedelta
  from typing import Any
  import numpy
  import pandas
  import polars
  from polars.testing import assert_frame_equal
label_desc: Use image node_id 12 for calling a global function with example usage: test_opaque_filter_on_lists_3784() without return types