from sqlalchemy import inspect
from sqlalchemy.engine.reflection import Inspector
from sqlmodel import create_engine


def test_create_db_and_table(clear_sqlmodel):
    from docs_src.tutorial.create_db_and_table import tutorial003 as mod

    mod.sqlite_url = "sqlite://"
    mod.engine = create_engine(mod.sqlite_url)
    mod.create_db_and_tables()
    insp: Inspector = inspect(mod.engine)
    assert insp.has_table(str(mod.Hero.__tablename__))

docs_src.tutorial.create_db_and_table.tutorial003.create_db_and_tables sqlalchemy.inspect sqlmodel.create_engine
[((289, 318), 'sqlmodel.create_engine', 'create_engine', (['mod.sqlite_url'], {}), '(mod.sqlite_url)\n', (302, 318), False, 'from sqlmodel import create_engine\n'), ((323, 349), 'docs_src.tutorial.create_db_and_table.tutorial003.create_db_and_tables', 'mod.create_db_and_tables', ([], {}), '()\n', (347, 349), True, 'from docs_src.tutorial.create_db_and_table import tutorial003 as mod\n'), ((372, 391), 'sqlalchemy.inspect', 'inspect', (['mod.engine'], {}), '(mod.engine)\n', (379, 391), False, 'from sqlalchemy import inspect\n')]