code: def test_mixin_attr(db: SQLAlchemy) -> None:
      """A declared attr tablename will be used down multiple levels of
      inheritance.
      """
  
      class Mixin:
          @sa_orm.declared_attr  # type: ignore[arg-type]
          def __tablename__(cls) -> str:  # noqa: B902
              return cls.__name__.upper()  # type: ignore[attr-defined,no-any-return]
  
      class Bird(Mixin, db.Model):
          id = sa.Column(sa.Integer, primary_key=True)
  
      class Duck(Bird):
          # object reference
          id = sa.Column(
              sa.Integer, sa.ForeignKey(Bird.id), primary_key=True
          )
  
      class Mallard(Duck):
          # string reference
          id = sa.Column(
              sa.Integer, sa.ForeignKey("DUCK.id"), primary_key=True
          )
  
      assert Bird.__tablename__ == "BIRD"
      assert Duck.__tablename__ == "DUCK"
      assert Mallard.__tablename__ == "MALLARD"
  
imports: from __future__ import annotations
  import inspect
  import typing
  import pytest
  import sqlalchemy
  import sqlalchemy.exc
  import sqlalchemy.orm
  from flask_sqlalchemy import SQLAlchemy
  from flask_sqlalchemy.model import camel_to_snake_case
label_desc: Use image node_id 6 for calling a global function with example usage: test_mixin_attr(db) and returns: cls