code: def test_list_sum_and_dtypes() -> None:
      # ensure the dtypes of sum align with normal sum
      for dt_in, dt_out in [
          (pl.Int8, pl.Int64),
          (pl.Int16, pl.Int64),
          (pl.Int32, pl.Int32),
          (pl.Int64, pl.Int64),
          (pl.UInt8, pl.Int64),
          (pl.UInt16, pl.Int64),
          (pl.UInt32, pl.UInt32),
          (pl.UInt64, pl.UInt64),
      ]:
          df = pl.DataFrame(
              {"a": [[1], [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5]]},
              schema={"a": pl.List(dt_in)},
          )
  
          summed = df.explode("a").sum()
          assert summed.dtypes == [dt_out]
          assert summed.item() == 32
          assert df.select(pl.col("a").list.sum()).dtypes == [dt_out]
  
      assert df.select(pl.col("a").list.sum()).to_dict(
          as_series=False
      ) == {"a": [1, 6, 10, 15]}
  
      # include nulls
      assert pl.DataFrame(
          {"a": [[1], [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5], None]}
      ).select(pl.col("a").list.sum()).to_dict(as_series=False) == {
          "a": [1, 6, 10, 15, None]
      }
  
      # Booleans
      assert pl.DataFrame(
          {
              "a": [
                  [True],
                  [True, True],
                  [True, False, True],
                  [True, True, True, None],
              ]
          },
      ).select(pl.col("a").list.sum()).to_dict(as_series=False) == {
          "a": [1, 2, 2, 3]
      }
  
      assert pl.DataFrame(
          {"a": [[False], [False, False], [False, False, False]]},
      ).select(pl.col("a").list.sum()).to_dict(as_series=False) == {
          "a": [0, 0, 0]
      }
  
      assert pl.DataFrame(
          {"a": [[True], [True, True], [True, True, True]]},
      ).select(pl.col("a").list.sum()).to_dict(as_series=False) == {
          "a": [1, 2, 3]
      }
  
imports: from __future__ import annotations
  import pickle
  from datetime import date, datetime, time
  from typing import TYPE_CHECKING, Any
  import pandas
  import pytest
  import polars
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 19 for calling a global function with example usage: test_list_sum_and_dtypes() without return types