code: def test_align_frames_duplicate_key() -> None:
      # setup some test frames with duplicate key/alignment values
      df1 = pl.DataFrame({"x": ["a", "a", "a", "e"], "y": [1, 2, 4, 5]})
      df2 = pl.DataFrame(
          {"y": [0, 0, -1], "z": [5.5, 6.0, 7.5], "x": ["a", "b", "b"]}
      )
  
      # align rows, confirming correctness and original column order
      af1, af2 = pl.align_frames(df1, df2, on="x")
  
      # shape: (6, 2)   shape: (6, 3)
      # ┌─────┬──────┐  ┌──────┬──────┬─────┐
      # │ x   ┆ y    │  │ y    ┆ z    ┆ x   │
      # │ --- ┆ ---  │  │ ---  ┆ ---  ┆ --- │
      # │ str ┆ i64  │  │ i64  ┆ f64  ┆ str │
      # ╞═════╪══════╡  ╞══════╪══════╪═════╡
      # │ a   ┆ 1    │  │ 0    ┆ 5.5  ┆ a   │
      # │ a   ┆ 2    │  │ 0    ┆ 5.5  ┆ a   │
      # │ a   ┆ 4    │  │ 0    ┆ 5.5  ┆ a   │
      # │ b   ┆ null │  │ 0    ┆ 6.0  ┆ b   │
      # │ b   ┆ null │  │ -1   ┆ 7.5  ┆ b   │
      # │ e   ┆ 5    │  │ null ┆ null ┆ e   │
      # └─────┴──────┘  └──────┴──────┴─────┘
      assert af1.rows() == [
          ("a", 1),
          ("a", 2),
          ("a", 4),
          ("b", None),
          ("b", None),
          ("e", 5),
      ]
      assert af2.rows() == [
          (0, 5.5, "a"),
          (0, 5.5, "a"),
          (0, 5.5, "a"),
          (0, 6.0, "b"),
          (-1, 7.5, "b"),
          (None, None, "e"),
      ]
  
      # align frames the other way round, using "left" alignment strategy
      af1, af2 = pl.align_frames(df2, df1, on="x", how="left")
  
      # shape: (5, 3)        shape: (5, 2)
      # ┌─────┬─────┬─────┐  ┌─────┬──────┐
      # │ y   ┆ z   ┆ x   │  │ x   ┆ y    │
      # │ --- ┆ --- ┆ --- │  │ --- ┆ ---  │
      # │ i64 ┆ f64 ┆ str │  │ str ┆ i64  │
      # ╞═════╪═════╪═════╡  ╞═════╪══════╡
      # │ 0   ┆ 5.5 ┆ a   │  │ a   ┆ 1    │
      # │ 0   ┆ 5.5 ┆ a   │  │ a   ┆ 2    │
      # │ 0   ┆ 5.5 ┆ a   │  │ a   ┆ 4    │
      # │ 0   ┆ 6.0 ┆ b   │  │ b   ┆ null │
      # │ -1  ┆ 7.5 ┆ b   │  │ b   ┆ null │
      # └─────┴─────┴─────┘  └─────┴──────┘
      assert af1.rows() == [
          (0, 5.5, "a"),
          (0, 5.5, "a"),
          (0, 5.5, "a"),
          (0, 6.0, "b"),
          (-1, 7.5, "b"),
      ]
      assert af2.rows() == [
          ("a", 1),
          ("a", 2),
          ("a", 4),
          ("b", None),
          ("b", None),
      ]
  
imports: from __future__ import annotations
  from datetime import timedelta
  from typing import TYPE_CHECKING
  import numpy
  import pytest
  import polars
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 10 for calling a global function with example usage: test_align_frames_duplicate_key() without return types