code: def test_group_by_dynamic_by_monday_and_offset_5444() -> None:
      df = pl.DataFrame(
          {
              "date": [
                  "2022-11-01",
                  "2022-11-02",
                  "2022-11-05",
                  "2022-11-08",
                  "2022-11-08",
                  "2022-11-09",
                  "2022-11-10",
              ],
              "label": ["a", "b", "a", "a", "b", "a", "b"],
              "value": [1, 2, 3, 4, 5, 6, 7],
          }
      ).with_columns(
          pl.col("date").str.strptime(pl.Date, "%Y-%m-%d").set_sorted()
      )
  
      result = df.group_by_dynamic(
          "date", every="1w", offset="1d", by="label", start_by="monday"
      ).agg(pl.col("value").sum())
  
      assert result.to_dict(as_series=False) == {
          "label": ["a", "a", "b", "b"],
          "date": [
              date(2022, 11, 1),
              date(2022, 11, 8),
              date(2022, 11, 1),
              date(2022, 11, 8),
          ],
          "value": [4, 10, 2, 12],
      }
  
      # test empty
      result_empty = (
          df.filter(pl.col("date") == date(1, 1, 1))
          .group_by_dynamic(
              "date",
              every="1w",
              offset="1d",
              by="label",
              start_by="monday",
          )
          .agg(pl.col("value").sum())
      )
      assert result_empty.schema == result.schema
  
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 4 for calling a global function with example usage: test_group_by_dynamic_by_monday_and_offset_5444() without return types