code: def test_duration_aggs() -> None:
      df = pl.DataFrame(
          {
              "time1": pl.datetime_range(
                  start=datetime(2022, 12, 12),
                  end=datetime(2022, 12, 18),
                  interval="1d",
                  eager=True,
              ),
              "time2": pl.datetime_range(
                  start=datetime(2023, 1, 12),
                  end=datetime(2023, 1, 18),
                  interval="1d",
                  eager=True,
              ),
          }
      )
  
      df = df.with_columns(
          (pl.col("time2") - pl.col("time1")).alias("time_difference")
      )
  
      assert df.select("time_difference").mean().to_dict(
          as_series=False
      ) == {"time_difference": [timedelta(days=31)]}
      assert df.group_by(pl.lit(1)).agg(
          pl.mean("time_difference")
      ).to_dict(as_series=False) == {
          "literal": [1],
          "time_difference": [timedelta(days=31)],
      }
  
imports: from __future__ import annotations
  from datetime import date, datetime, timedelta
  from typing import TYPE_CHECKING, Any
  import numpy
  import pytest
  import polars
  from polars.testing import assert_frame_equal
label_desc: Use image node_id 3 for calling a global function with example usage: test_duration_aggs() without return types