code: def test_scope(app: Flask, db: SQLAlchemy) -> None:
      with pytest.raises(RuntimeError):
          db.session()
  
      with app.app_context():
          first = db.session()
          second = db.session()
          assert first is second
          assert isinstance(first, Session)
  
      with app.app_context():
          third = db.session()
          assert first is not third
  
file_path: flask-sqlalchemy/tests/test_session.py
imports: from __future__ import annotations
  import typing
  import pytest
  import sqlalchemy
  import sqlalchemy.orm
  from flask import Flask
  from flask_sqlalchemy import SQLAlchemy
  from flask_sqlalchemy.session import Session
label_desc: Use image node_id 1 for calling a global function with example usage: test_scope(app, db) without return types