code: def test_rolling_extrema() -> None:
      # sorted data and nulls flags trigger different kernels
      df = (
          pl.DataFrame(
              {
                  "col1": pl.int_range(0, 7, eager=True),
                  "col2": pl.int_range(0, 7, eager=True).reverse(),
              }
          )
      ).with_columns(
          [
              pl.when(pl.int_range(0, pl.count(), eager=False) < 2)
              .then(None)
              .otherwise(pl.all())
              .name.suffix("_nulls")
          ]
      )
  
      assert df.select([pl.all().rolling_min(3)]).to_dict(
          as_series=False
      ) == {
          "col1": [None, None, 0, 1, 2, 3, 4],
          "col2": [None, None, 4, 3, 2, 1, 0],
          "col1_nulls": [None, None, None, None, 2, 3, 4],
          "col2_nulls": [None, None, None, None, 2, 1, 0],
      }
  
      assert df.select([pl.all().rolling_max(3)]).to_dict(
          as_series=False
      ) == {
          "col1": [None, None, 2, 3, 4, 5, 6],
          "col2": [None, None, 6, 5, 4, 3, 2],
          "col1_nulls": [None, None, None, None, 4, 5, 6],
          "col2_nulls": [None, None, None, None, 4, 3, 2],
      }
  
      # shuffled data triggers other kernels
      df = df.select([pl.all().shuffle(0)])
      assert df.select([pl.all().rolling_min(3)]).to_dict(
          as_series=False
      ) == {
          "col1": [None, None, 0, 0, 1, 2, 2],
          "col2": [None, None, 0, 2, 1, 1, 1],
          "col1_nulls": [None, None, None, None, None, 2, 2],
          "col2_nulls": [None, None, None, None, None, 1, 1],
      }
  
      assert df.select([pl.all().rolling_max(3)]).to_dict(
          as_series=False
      ) == {
          "col1": [None, None, 6, 4, 5, 5, 5],
          "col2": [None, None, 6, 6, 5, 4, 4],
          "col1_nulls": [None, None, None, None, None, 5, 5],
          "col2_nulls": [None, None, None, None, None, 4, 4],
      }
  
imports: from __future__ import annotations
  from datetime import date, datetime, timedelta
  from typing import TYPE_CHECKING
  import numpy
  import pytest
  from numpy import nan
  import polars
  from polars.exceptions import ComputeError
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 7 for calling a global function with example usage: test_rolling_extrema() without return types