def assert_revision(
    engine: Engine,
    expected: Union[None, str],
    status: Literal["in_sync", "behind"],
):
    """Asserts that the version of the database `engine` is `expected` and
    has the `status` flag set."""

    revisions = db_migrations.DbRevisions.load(engine)
    assert revisions.current == expected, f"{revisions.current} != {expected}"
    assert getattr(revisions, status)
Asserts that the version of the database `engine` is `expected` and
    has the `status` flag set.
tests/integration/test_database.py