code: def test_excel_sparklines(
      engine: Literal["xlsx2csv", "openpyxl", "pyxlsb"]
  ) -> None:
      from xlsxwriter import Workbook
  
      # note that we don't (quite) expect sparkline export to round-trip as we
      # inject additional empty columns to hold them (which will read as nulls).
      df = pl.DataFrame(
          {
              "id": ["aaa", "bbb", "ccc", "ddd", "eee"],
              "q1": [100, 55, -20, 0, 35],
              "q2": [30, -10, 15, 60, 20],
              "q3": [-50, 0, 40, 80, 80],
              "q4": [75, 55, 25, -10, -55],
          }
      )
  
      # also: confirm that we can use a Workbook directly with "write_excel"
      xls = BytesIO()
      with Workbook(xls) as wb:
          df.write_excel(
              workbook=wb,
              worksheet="frame_data",
              table_style="Table Style Light 2",
              dtype_formats={pl.INTEGER_DTYPES: "#,##0_);(#,##0)"},
              column_formats={cs.starts_with("h"): "#,##0_);(#,##0)"},
              sparklines={
                  "trend": ["q1", "q2", "q3", "q4"],
                  "+/-": {
                      "columns": ["q1", "q2", "q3", "q4"],
                      "insert_after": "id",
                      "type": "win_loss",
                  },
              },
              conditional_formats={
                  cs.starts_with("q", "h"): {
                      "type": "2_color_scale",
                      "min_color": "#95b3d7",
                      "max_color": "#ffffff",
                  }
              },
              column_widths={cs.starts_with("q", "h"): 40},
              row_totals={
                  "h1": ("q1", "q2"),
                  "h2": ("q3", "q4"),
              },
              hide_gridlines=True,
              row_heights=35,
              sheet_zoom=125,
          )
  
      tables = {
          tbl["name"]
          for tbl in wb.get_worksheet_by_name("frame_data").tables
      }
      assert "Frame0" in tables
  
      with warnings.catch_warnings():
          warnings.simplefilter("ignore", UserWarning)
          xldf = pl.read_excel(
              xls, sheet_name="frame_data", engine=engine
          )
  
      # ┌─────┬──────┬─────┬─────┬─────┬─────┬───────┬─────┬─────┐
      # │ id  ┆ +/-  ┆ q1  ┆ q2  ┆ q3  ┆ q4  ┆ trend ┆ h1  ┆ h2  │
      # │ --- ┆ ---  ┆ --- ┆ --- ┆ --- ┆ --- ┆ ---   ┆ --- ┆ --- │
      # │ str ┆ str  ┆ i64 ┆ i64 ┆ i64 ┆ i64 ┆ str   ┆ i64 ┆ i64 │
      # ╞═════╪══════╪═════╪═════╪═════╪═════╪═══════╪═════╪═════╡
      # │ aaa ┆ null ┆ 100 ┆ 30  ┆ -50 ┆ 75  ┆ null  ┆ 0   ┆ 0   │
      # │ bbb ┆ null ┆ 55  ┆ -10 ┆ 0   ┆ 55  ┆ null  ┆ 0   ┆ 0   │
      # │ ccc ┆ null ┆ -20 ┆ 15  ┆ 40  ┆ 25  ┆ null  ┆ 0   ┆ 0   │
      # │ ddd ┆ null ┆ 0   ┆ 60  ┆ 80  ┆ -10 ┆ null  ┆ 0   ┆ 0   │
      # │ eee ┆ null ┆ 35  ┆ 20  ┆ 80  ┆ -55 ┆ null  ┆ 0   ┆ 0   │
      # └─────┴──────┴─────┴─────┴─────┴─────┴───────┴─────┴─────┘
  
      for sparkline_col in ("+/-", "trend"):
          assert set(xldf[sparkline_col]) == {None}
  
      assert xldf.columns == [
          "id",
          "+/-",
          "q1",
          "q2",
          "q3",
          "q4",
          "trend",
          "h1",
          "h2",
      ]
      assert_frame_equal(df, xldf.drop("+/-", "trend", "h1", "h2"))
  
imports: from __future__ import annotations
  import warnings
  from collections import OrderedDict
  from datetime import date, datetime
  from io import BytesIO
  from typing import TYPE_CHECKING, Any, Callable, Literal
  import pytest
  import polars
  import polars.selectors
  from polars.exceptions import NoDataError, ParameterCollisionError
  from polars.testing import assert_frame_equal
label_desc: Use image node_id 19 for calling a global function with example usage: test_excel_sparklines(engine) without return types