def METHOD_NAME(alembic_config, tmpdir, migration):
    migrations = list_migrations(alembic_config, migration)
    if len(migrations) > 1:
        target = migrations[-2]
        upgrade(alembic_config, target)
    else:
        # The first migration is the degenerate case where we don't need to
        # get the database to some base state.
        pass
    session = make_session_maker(str(tmpdir.mkdir("original")))()
    original_schema = get_schema(session)
    upgrade(alembic_config, "+1")
    downgrade(alembic_config, "-1")
    session = make_session_maker(str(tmpdir.mkdir("reverted")))()
    reverted_schema = get_schema(session)
    # The initial migration is a degenerate case because it creates the table
    # 'alembic_version', but rolling back the migration doesn't clear it.
    if len(migrations) == 1:
        reverted_schema = {k: v for k, v in reverted_schema.items() if k[2] != "alembic_version"}
    assert_schemas_equal(reverted_schema, original_schema)