code: def test_view_get_or_404_typed(db: SQLAlchemy, app: Flask) -> None:
      # Copied and pasted from conftest.py
      if issubclass(db.Model, (sa_orm.MappedAsDataclass)):
  
          class Todo(db.Model):
              id: sa_orm.Mapped[int] = sa_orm.mapped_column(
                  sa.Integer, init=False, primary_key=True
              )
              title: sa_orm.Mapped[str] = sa_orm.mapped_column(
                  sa.String, nullable=True, default=None
              )
  
      elif issubclass(
          db.Model,
          (sa_orm.DeclarativeBase, sa_orm.DeclarativeBaseNoMeta),
      ):
  
          class Todo(db.Model):  # type: ignore[no-redef]
              id: sa_orm.Mapped[int] = sa_orm.mapped_column(
                  sa.Integer, primary_key=True
              )
              title: sa_orm.Mapped[str] = sa_orm.mapped_column(
                  sa.String, nullable=True
              )
  
      else:
  
          class Todo(db.Model):  # type: ignore[no-redef]
              id = sa.Column(sa.Integer, primary_key=True)
              title = sa.Column(sa.String)
  
      db.create_all()
  
      todo = Todo()
      todo.title = "Python"
      db.session.add(todo)
      db.session.commit()
      result = db.get_or_404(Todo, 1)
      assert result.title == "Python"
      assert result is todo
      if hasattr(t, "assert_type"):
          t.assert_type(result, Todo)
      with pytest.raises(NotFound):
          assert db.get_or_404(Todo, 2)
      db.drop_all()
  
file_path: flask-sqlalchemy/tests/test_view_query.py
imports: from __future__ import annotations
  import typing
  import pytest
  import sqlalchemy
  import sqlalchemy.orm
  from flask import Flask
  from werkzeug.exceptions import NotFound
  from flask_sqlalchemy import SQLAlchemy
label_desc: Use image node_id 5 for calling a global function with example usage: test_view_get_or_404_typed(db, app) without return types