code: def test_read_database_exceptions(
      read_method: str,
      query: str,
      protocol: Any,
      errclass: type[Exception],
      errmsg: str,
      engine: DbReadEngine | None,
      execute_options: dict[str, Any] | None,
      kwargs: dict[str, Any] | None,
      tmp_path: Path,
  ) -> None:
      if read_method == "read_database_uri":
          conn = (
              f"{protocol}://test"
              if isinstance(protocol, str)
              else protocol
          )
          params = {"uri": conn, "query": query, "engine": engine}
      else:
          params = {"connection": protocol, "query": query}
          if execute_options:
              params["execute_options"] = execute_options
          if kwargs is not None:
              params.update(kwargs)
  
      read_database = getattr(pl, read_method)
      with pytest.raises(errclass, match=errmsg):
          read_database(**params)
  
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 7 for calling a global function with example usage: test_read_database_exceptions(read_method, query, protocol, errclass, errmsg, engine, execute_options, kwargs, tmp_path) without return types