code: def test_asof_join_nearest_by_date() -> None:
      df1 = pl.DataFrame(
          {
              "asof_key": [
                  date(2019, 12, 30),
                  date(2020, 1, 1),
                  date(2020, 1, 2),
                  date(2020, 1, 6),
                  date(2020, 1, 1),
              ],
              "group": [1, 1, 1, 2, 2],
              "a": [1, 2, 3, 2, 5],
          }
      ).sort(by=["group", "asof_key"])
  
      df2 = pl.DataFrame(
          {
              "asof_key": [
                  date(2020, 1, 1),
                  date(2020, 1, 2),
                  date(2020, 1, 5),
                  date(2020, 1, 1),
              ],
              "group": [1, 1, 2, 2],
              "b": [1, 2, 3, 4],
          }
      ).sort(by=["group", "asof_key"])
  
      expected = pl.DataFrame(
          {
              "asof_key": [
                  date(2019, 12, 30),
                  date(2020, 1, 1),
                  date(2020, 1, 2),
                  date(2020, 1, 6),
                  date(2020, 1, 1),
              ],
              "group": [1, 1, 1, 2, 2],
              "a": [1, 2, 3, 2, 5],
              "b": [1, 1, 2, 3, 4],
          }
      ).sort(by=["group", "asof_key"])
  
      out = df1.join_asof(
          df2, on="asof_key", by="group", strategy="nearest"
      )
      assert_frame_equal(out, expected)
  
imports: from datetime import date, datetime, timedelta
  from typing import Any
  import numpy
  import pytest
  import polars
  from polars.testing import assert_frame_equal
label_desc: Use image node_id 18 for calling a global function with example usage: test_asof_join_nearest_by_date() without return types