code: def test_struct_get_field_by_index() -> None:
      df = pl.DataFrame({"val": [{"a": 1, "b": 2}]})
      expected = {"b": [2]}
      assert (
          df.select(pl.all().struct[1]).to_dict(as_series=False)
          == expected
      )
  
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 46 for calling a global function with example usage: test_struct_get_field_by_index() without return types