code: def test_first_or_404(db: SQLAlchemy, Todo: t.Any) -> None:
      db.session.add(Todo(title="a"))
      db.session.commit()
      assert Todo.query.filter_by(title="a").first_or_404().title == "a"
  
      with pytest.raises(NotFound):
          Todo.query.filter_by(title="b").first_or_404()
  
file_path: flask-sqlalchemy/tests/test_legacy_query.py
imports: from __future__ import annotations
  import typing
  import warnings
  import pytest
  import sqlalchemy
  import sqlalchemy.exc
  from flask import Flask
  from werkzeug.exceptions import NotFound
  from flask_sqlalchemy import SQLAlchemy
  from flask_sqlalchemy.query import Query
label_desc: Use image node_id 3 for calling a global function with example usage: test_first_or_404(db, Todo) without return types