code: def test_group_by_dynamic_label_with_by(
      label: Label, expected: list[datetime]
  ) -> None:
      df = pl.DataFrame(
          {
              "ts": [
                  datetime(2020, 1, 1, 1),
                  datetime(2020, 1, 2, 2),
                  datetime(2020, 1, 3, 3),
              ],
              "n": [1, 2, 3],
          }
      ).sort("ts")
      result = (
          df.group_by_dynamic("ts", every="1d", label=label)
          .agg(pl.col("n"))["ts"]
          .to_list()
      )
      assert result == expected
  
imports: from __future__ import annotations
  import sys
  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 7 for calling a global function with example usage: test_group_by_dynamic_label_with_by(label, expected) without return types