code: def test_struct_cols() -> None:
      """Test that struct columns can be imported and work as expected."""
  
      def build_struct_df(
          data: list[dict[str, object]]
      ) -> pl.DataFrame:
          """
          Build Polars df from list of dicts.
  
          Can't import directly because of issue #3145.
  
          """
          arrow_df = pa.Table.from_pylist(data)
          polars_df = pl.from_arrow(arrow_df)
          assert isinstance(polars_df, pl.DataFrame)
          return polars_df
  
      # struct column
      df = build_struct_df([{"struct_col": {"inner": 1}}])
      assert df.columns == ["struct_col"]
      assert df.schema == {"struct_col": pl.Struct}
      assert df["struct_col"].struct.field("inner").to_list() == [1]
  
      # struct in struct
      df = build_struct_df(
          [{"nested_struct_col": {"struct_col": {"inner": 1}}}]
      )
      assert df["nested_struct_col"].struct.field(
          "struct_col"
      ).struct.field("inner").to_list() == [1]
  
      # struct in list
      df = build_struct_df([{"list_of_struct_col": [{"inner": 1}]}])
      assert df["list_of_struct_col"][0].struct.field(
          "inner"
      ).to_list() == [1]
  
      # struct in list in struct
      df = build_struct_df(
          [
              {
                  "struct_list_struct_col": {
                      "list_struct_col": [{"inner": 1}]
                  }
              }
          ]
      )
      assert df["struct_list_struct_col"].struct.field(
          "list_struct_col"
      )[0].struct.field("inner").to_list() == [1]
  
imports: from __future__ import annotations
  from dataclasses import dataclass
  from datetime import datetime, time
  from typing import TYPE_CHECKING
  import pandas
  import pyarrow
  import pytest
  import polars
  import polars.selectors
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 12 for calling a global function with example usage: test_struct_cols() and returns: polars_df