code: def test_group_by_dynamic_flat_agg_4814() -> None:
      df = pl.DataFrame({"a": [1, 2, 2], "b": [1, 8, 12]}).set_sorted(
          "a"
      )
  
      assert df.group_by_dynamic("a", every="1i", period="2i").agg(
          [
              (pl.col("b").sum() / pl.col("a").sum()).alias(
                  "sum_ratio_1"
              ),
              (pl.col("b").last() / pl.col("a").last()).alias(
                  "last_ratio_1"
              ),
              (pl.col("b") / pl.col("a")).last().alias("last_ratio_2"),
          ]
      ).to_dict(as_series=False) == {
          "a": [0, 1, 2],
          "sum_ratio_1": [1.0, 4.2, 5.0],
          "last_ratio_1": [1.0, 6.0, 6.0],
          "last_ratio_2": [1.0, 6.0, 6.0],
      }
  
imports: from __future__ import annotations
  from collections import OrderedDict
  from datetime import datetime, timedelta
  from typing import Any
  import pytest
  import polars
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 16 for calling a global function with example usage: test_group_by_dynamic_flat_agg_4814() without return types