code: def test_read_database_mocked(
      driver: str,
      batch_size: int | None,
      iter_batches: bool,
      expected_call: str,
  ) -> None:
      # since we don't have access to snowflake/databricks/etc from CI we
      # mock them so we can check that we're calling the expected methods
      arrow = pl.DataFrame(
          {"x": [1, 2, 3], "y": ["aa", "bb", "cc"]}
      ).to_arrow()
      mc = MockConnection(
          driver,
          batch_size,
          test_data=arrow,
          repeat_batch_calls=_ARROW_DRIVER_REGISTRY_.get(driver, {}).get(  # type: ignore[call-overload]
              "repeat_batch_calls", False
          ),
      )
      res = pl.read_database(  # type: ignore[call-overload]
          query="SELECT * FROM test_data",
          connection=mc,
          iter_batches=iter_batches,
          batch_size=batch_size,
      )
      if iter_batches:
          assert isinstance(res, GeneratorType)
          res = pl.concat(res)
  
      assert expected_call in mc.cursor().called
      assert res.rows() == [(1, "aa"), (2, "bb"), (3, "cc")]
  
imports: from __future__ import annotations
  import os
  import sqlite3
  import sys
  from contextlib import suppress
  from datetime import date
  from pathlib import Path
  from types import GeneratorType
  from typing import TYPE_CHECKING, Any, NamedTuple
  import pytest
  from sqlalchemy import Integer, MetaData, Table, create_engine, func, select
  from sqlalchemy.sql.expression import cast
  import polars
  from polars.exceptions import UnsuitableSQLError
  from polars.io.database import _ARROW_DRIVER_REGISTRY_
  from polars.testing import assert_frame_equal
label_desc: Use image node_id 6 for calling a global function with example usage: test_read_database_mocked(driver, batch_size, iter_batches, expected_call) without return types