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


def test_tutorial001(clear_sqlmodel):
    from docs_src.tutorial.connect.create_tables import tutorial001 as mod

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

docs_src.tutorial.connect.create_tables.tutorial001.main sqlalchemy.inspect sqlmodel.create_engine
[((283, 312), 'sqlmodel.create_engine', 'create_engine', (['mod.sqlite_url'], {}), '(mod.sqlite_url)\n', (296, 312), False, 'from sqlmodel import create_engine\n'), ((317, 327), 'docs_src.tutorial.connect.create_tables.tutorial001.main', 'mod.main', ([], {}), '()\n', (325, 327), True, 'from docs_src.tutorial.connect.create_tables import tutorial001 as mod\n'), ((350, 369), 'sqlalchemy.inspect', 'inspect', (['mod.engine'], {}), '(mod.engine)\n', (357, 369), False, 'from sqlalchemy import inspect\n')]