code: def test_sort_by() -> None:
      df = pl.DataFrame(
          {
              "a": [1, 2, 3, 4, 5],
              "b": [1, 1, 1, 2, 2],
              "c": [2, 3, 1, 2, 1],
          }
      )
  
      by: list[pl.Expr | str]
      for by in [["b", "c"], [pl.col("b"), "c"]]:  # type: ignore[assignment]
          out = df.select(pl.col("a").sort_by(by))
          assert out["a"].to_list() == [3, 1, 2, 5, 4]
  
      # Columns as positional arguments are also accepted
      out = df.select(pl.col("a").sort_by("b", "c"))
      assert out["a"].to_list() == [3, 1, 2, 5, 4]
  
      out = df.select(pl.col("a").sort_by(by, descending=False))
      assert out["a"].to_list() == [3, 1, 2, 5, 4]
  
      out = df.select(pl.col("a").sort_by(by, descending=True))
      assert out["a"].to_list() == [4, 5, 2, 1, 3]
  
      out = df.select(pl.col("a").sort_by(by, descending=[True, False]))
      assert out["a"].to_list() == [5, 4, 3, 1, 2]
  
      # by can also be a single column
      out = df.select(pl.col("a").sort_by("b", descending=[False]))
      assert out["a"].to_list() == [1, 2, 3, 4, 5]
  
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 2 for calling a global function with example usage: test_sort_by() without return types