code: def test_asof_join_nearest() -> None:
      # Generic join_asof
      df1 = pl.DataFrame(
          {
              "asof_key": [-1, 1, 2, 4, 6],
              "a": [1, 2, 3, 4, 5],
          }
      ).sort(by="asof_key")
  
      df2 = pl.DataFrame(
          {
              "asof_key": [-1, 2, 4, 5],
              "b": [1, 2, 3, 4],
          }
      ).sort(by="asof_key")
  
      expected = pl.DataFrame(
          {
              "asof_key": [-1, 1, 2, 4, 6],
              "a": [1, 2, 3, 4, 5],
              "b": [1, 2, 2, 3, 4],
          }
      )
  
      out = df1.join_asof(df2, on="asof_key", strategy="nearest")
      assert_frame_equal(out, expected)
  
      # Edge case: last item of right matches multiples on left
      df1 = pl.DataFrame(
          {
              "asof_key": [9, 9, 10, 10, 10],
              "a": [1, 2, 3, 4, 5],
          }
      ).set_sorted("asof_key")
      df2 = pl.DataFrame(
          {
              "asof_key": [1, 2, 3, 10],
              "b": [1, 2, 3, 4],
          }
      ).set_sorted("asof_key")
      expected = pl.DataFrame(
          {
              "asof_key": [9, 9, 10, 10, 10],
              "a": [1, 2, 3, 4, 5],
              "b": [4, 4, 4, 4, 4],
          }
      )
  
      out = df1.join_asof(df2, on="asof_key", 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 14 for calling a global function with example usage: test_asof_join_nearest() without return types