code: def test_sort_by_logical() -> None:
      test = pl.DataFrame(
          {
              "start": [
                  date(2020, 5, 6),
                  date(2020, 5, 13),
                  date(2020, 5, 10),
              ],
              "end": [
                  date(2020, 12, 31),
                  date(2020, 12, 31),
                  date(2021, 1, 1),
              ],
              "num": [0, 1, 2],
          }
      )
      assert test.select(
          [pl.col("num").sort_by(["start", "end"]).alias("n1")]
      )["n1"].to_list() == [0, 2, 1]
      df = pl.DataFrame(
          {
              "dt1": [
                  date(2022, 2, 1),
                  date(2022, 3, 1),
                  date(2022, 4, 1),
              ],
              "dt2": [
                  date(2022, 2, 2),
                  date(2022, 3, 2),
                  date(2022, 4, 2),
              ],
              "name": ["a", "b", "a"],
              "num": [3, 4, 1],
          }
      )
      assert df.group_by("name").agg(
          [pl.col("num").sort_by(["dt1", "dt2"])]
      ).sort("name").to_dict(as_series=False) == {
          "name": ["a", "b"],
          "num": [[3, 1], [4]],
      }
  
imports: from __future__ import annotations
  from datetime import date, datetime
  from typing import Any
  import pytest
  import polars
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 26 for calling a global function with example usage: test_sort_by_logical() without return types