code: def test_join_asof_tolerance() -> None:
      df_trades = pl.DataFrame(
          {
              "time": [
                  datetime(2020, 1, 1, 9, 0, 1),
                  datetime(2020, 1, 1, 9, 0, 1),
                  datetime(2020, 1, 1, 9, 0, 3),
                  datetime(2020, 1, 1, 9, 0, 6),
              ],
              "stock": ["A", "B", "B", "C"],
              "trade": [101, 299, 301, 500],
          }
      ).set_sorted("time")
  
      df_quotes = pl.DataFrame(
          {
              "time": [
                  datetime(2020, 1, 1, 9, 0, 0),
                  datetime(2020, 1, 1, 9, 0, 2),
                  datetime(2020, 1, 1, 9, 0, 4),
                  datetime(2020, 1, 1, 9, 0, 6),
              ],
              "stock": ["A", "B", "C", "A"],
              "quote": [100, 300, 501, 102],
          }
      ).set_sorted("time")
  
      assert df_trades.join_asof(
          df_quotes, on="time", by="stock", tolerance="2s"
      ).to_dict(as_series=False) == {
          "time": [
              datetime(2020, 1, 1, 9, 0, 1),
              datetime(2020, 1, 1, 9, 0, 1),
              datetime(2020, 1, 1, 9, 0, 3),
              datetime(2020, 1, 1, 9, 0, 6),
          ],
          "stock": ["A", "B", "B", "C"],
          "trade": [101, 299, 301, 500],
          "quote": [100, None, 300, 501],
      }
  
      assert df_trades.join_asof(
          df_quotes, on="time", by="stock", tolerance="1s"
      ).to_dict(as_series=False) == {
          "time": [
              datetime(2020, 1, 1, 9, 0, 1),
              datetime(2020, 1, 1, 9, 0, 1),
              datetime(2020, 1, 1, 9, 0, 3),
              datetime(2020, 1, 1, 9, 0, 6),
          ],
          "stock": ["A", "B", "B", "C"],
          "trade": [101, 299, 301, 500],
          "quote": [100, None, 300, None],
      }
  
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 8 for calling a global function with example usage: test_join_asof_tolerance() without return types