code: def test_database_schema(tmp_path, Database):
      kwargs = (
          dict(name="test_table") if Database == SQLiteDatabase else {}
      )
  
      path = osp.join(tmp_path, "tuple_storage.db")
      schema = (
          int,
          float,
          str,
          dict(dtype=torch.float, size=(2, -1)),
          object,
      )
      db = Database(path, schema=schema, **kwargs)
      assert db.schema == {
          0: int,
          1: float,
          2: str,
          3: TensorInfo(dtype=torch.float, size=(2, -1)),
          4: object,
      }
  
      data1 = (1, 0.1, "a", torch.randn(2, 8), Data(x=torch.randn(8)))
      data2 = (
          2,
          float("inf"),
          "b",
          torch.randn(2, 16),
          Data(x=torch.randn(8)),
      )
      data3 = (
          3,
          float("NaN"),
          "c",
          torch.randn(2, 32),
          Data(x=torch.randn(8)),
      )
      db.insert(0, data1)
      db.multi_insert([1, 2], [data2, data3])
  
      out1 = db.get(0)
      out2, out3 = db.multi_get([1, 2])
  
      for out, data in zip([out1, out2, out3], [data1, data2, data3]):
          assert out[0] == data[0]
          if math.isnan(data[1]):
              assert math.isnan(out[1])
          else:
              assert out[1] == data[1]
          assert out[2] == data[2]
          assert torch.equal(out[3], data[3])
          assert isinstance(out[4], Data) and len(out[4]) == 1
          assert torch.equal(out[4].x, data[4].x)
  
      db.close()
  
      path = osp.join(tmp_path, "dict_storage.db")
      schema = {
          "int": int,
          "float": float,
          "str": str,
          "tensor": dict(dtype=torch.float, size=(2, -1)),
          "data": object,
      }
      db = Database(path, schema=schema, **kwargs)
      assert db.schema == {
          "int": int,
          "float": float,
          "str": str,
          "tensor": TensorInfo(dtype=torch.float, size=(2, -1)),
          "data": object,
      }
  
      data1 = {
          "int": 1,
          "float": 0.1,
          "str": "a",
          "tensor": torch.randn(2, 8),
          "data": Data(x=torch.randn(1, 8)),
      }
      data2 = {
          "int": 2,
          "float": 0.2,
          "str": "b",
          "tensor": torch.randn(2, 16),
          "data": Data(x=torch.randn(2, 8)),
      }
      data3 = {
          "int": 3,
          "float": 0.3,
          "str": "c",
          "tensor": torch.randn(2, 32),
          "data": Data(x=torch.randn(3, 8)),
      }
      db.insert(0, data1)
      db.multi_insert([1, 2], [data2, data3])
  
      out1 = db.get(0)
      out2, out3 = db.multi_get([1, 2])
  
      for out, data in zip([out1, out2, out3], [data1, data2, data3]):
          assert out["int"] == data["int"]
          assert out["float"] == data["float"]
          assert out["str"] == data["str"]
          assert torch.equal(out["tensor"], data["tensor"])
          assert isinstance(out["data"], Data) and len(out["data"]) == 1
          assert torch.equal(out["data"].x, data["data"].x)
  
      db.close()
  
file_path: pytorch_geometric/test/data/test_database.py
imports: import math
  import os.path
  import pytest
  import torch
  from torch_geometric import EdgeIndex
  from torch_geometric.data import Data, RocksDatabase, SQLiteDatabase
  from torch_geometric.data.database import TensorInfo
  from torch_geometric.profile import benchmark
  from torch_geometric.testing import has_package, withPackage
label_desc: Use image node_id 2 for calling a global function with example usage: test_database_schema(tmp_path, Database) without return types