code: def test_paginate(db: SQLAlchemy, Todo: t.Any) -> None:
      db.session.add_all(Todo() for _ in range(150))
      db.session.commit()
      p = Todo.query.paginate()
      assert p.total == 150
      assert len(p.items) == 20
      p2 = p.next()
      assert p2.page == 2
      assert p2.total == 150
  
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 5 for calling a global function with example usage: test_paginate(db, Todo) without return types