code: def test_iter_rows() -> None:
      df = pl.DataFrame(
          {
              "a": [1, 2, 3],
              "b": [True, False, None],
          }
      ).with_columns(
          pl.Series(["a:b", "c:d", "e:f"])
          .str.split_exact(":", 1)
          .alias("c")
      )
  
      # expected struct values
      c1 = {"field_0": "a", "field_1": "b"}
      c2 = {"field_0": "c", "field_1": "d"}
      c3 = {"field_0": "e", "field_1": "f"}
  
      # Default iter_rows behaviour
      it = df.iter_rows()
      assert next(it) == (1, True, c1)
      assert next(it) == (2, False, c2)
      assert next(it) == (3, None, c3)
      with pytest.raises(StopIteration):
          next(it)
  
      # Apply explicit row-buffer size
      for sz in (0, 1, 2, 3, 4):
          it = df.iter_rows(buffer_size=sz)
          assert next(it) == (1, True, c1)
          assert next(it) == (2, False, c2)
          assert next(it) == (3, None, c3)
          with pytest.raises(StopIteration):
              next(it)
  
          # Return named rows
          it_named = df.iter_rows(named=True, buffer_size=sz)
          row = next(it_named)
          assert row == {"a": 1, "b": True, "c": c1}
          row = next(it_named)
          assert row == {"a": 2, "b": False, "c": c2}
          row = next(it_named)
          assert row == {"a": 3, "b": None, "c": c3}
  
          with pytest.raises(StopIteration):
              next(it_named)
  
      # test over chunked frame
      df = pl.concat(
          [
              pl.DataFrame({"id": [0, 1], "values": ["a", "b"]}),
              pl.DataFrame({"id": [2, 3], "values": ["c", "d"]}),
          ],
          rechunk=False,
      )
      assert df.n_chunks() == 2
      assert df.to_dicts() == [
          {"id": 0, "values": "a"},
          {"id": 1, "values": "b"},
          {"id": 2, "values": "c"},
          {"id": 3, "values": "d"},
      ]
  
file_path: polars/py-polars/tests/unit/test_rows.py
imports: import pytest
  import polars
  from polars.exceptions import NoRowsReturnedError, TooManyRowsReturnedError
label_desc: Use image node_id 4 for calling a global function with example usage: test_iter_rows() without return types