code: def test_nested_struct() -> None:
      df = pl.DataFrame({"d": [1, 2, 3], "e": ["foo", "bar", "biz"]})
      # Nest the dataframe
      nest_l1 = df.to_struct("c").to_frame()
      # Add another column on the same level
      nest_l1 = nest_l1.with_columns(pl.col("c").is_null().alias("b"))
      # Nest the dataframe again
      nest_l2 = nest_l1.to_struct("a").to_frame()
  
      assert isinstance(nest_l2.dtypes[0], pl.datatypes.Struct)
      assert [
          f.dtype for f in nest_l2.dtypes[0].fields
      ] == nest_l1.dtypes
      assert isinstance(nest_l1.dtypes[0], pl.datatypes.Struct)
  
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 9 for calling a global function with example usage: test_nested_struct() without return types