code: def test_sort_by_different_lengths() -> None:
      df = pl.DataFrame(
          {
              "group": ["a"] * 3 + ["b"] * 3,
              "col1": [1, 2, 3, 300, 200, 100],
              "col2": [1, 2, 3, 300, 1, 1],
          }
      )
      with pytest.raises(
          pl.ComputeError,
          match=r"the expression in `sort_by` argument must result in the same length",
      ):
          df.group_by("group").agg(
              [
                  pl.col("col1").sort_by(pl.col("col2").unique()),
              ]
          )
  
      with pytest.raises(
          pl.ComputeError,
          match=r"the expression in `sort_by` argument must result in the same length",
      ):
          df.group_by("group").agg(
              [
                  pl.col("col1").sort_by(pl.col("col2").arg_unique()),
              ]
          )
  
imports: from __future__ import annotations
  import io
  from datetime import date, datetime, time
  from decimal import Decimal
  from typing import TYPE_CHECKING, Any
  import numpy
  import pytest
  import polars
  from polars.datatypes.convert import dtype_to_py_type
  from polars.exceptions import InvalidOperationError
label_desc: Use image node_id 27 for calling a global function with example usage: test_sort_by_different_lengths() without return types