Newer
Older
cortex-hub / ai-hub / tests / db / test_database.py
import pytest
from sqlalchemy.orm import declarative_base

def test_base_is_declarative_base():
    """
    Tests if the Base object in app.db.database is a SQLAlchemy declarative_base.
    """
    # Arrange: Import the Base object from the module
    from app.db.database import Base

    # Assert: Check that the Base object's metaclass is the same as a new declarative_base's metaclass.
    # This confirms it's the correct type of object for SQLAlchemy models to inherit from.
    assert type(Base) == type(declarative_base())