code: def test_struct_order() -> None:
      df = pl.DataFrame({"col1": [{"a": 1, "b": 2}, {"b": 4, "a": 3}]})
      expected = {"col1": [{"a": 1, "b": 2}, {"a": 3, "b": 4}]}
      assert df.to_dict(as_series=False) == expected
  
      # null values should not trigger this
      assert (
          pl.Series(
              values=[
                  {"a": 1, "b": None},
                  {"a": 2, "b": 20},
              ],
          ).to_list()
      ) == [{"a": 1, "b": None}, {"a": 2, "b": 20}]
  
      assert (
          pl.Series(
              values=[
                  {"a": 1, "b": 10},
                  {"a": 2, "b": None},
              ],
          ).to_list()
      ) == [{"a": 1, "b": 10}, {"a": 2, "b": None}]
  
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 24 for calling a global function with example usage: test_struct_order() without return types