test_engine.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:sqlalchemy_aio 作者: RazerM 项目源码 文件源码
def test_implicit_transaction_success(engine, mytable):
    async with engine.begin() as conn:
        assert isinstance(conn, AsyncioConnection)

        await conn.execute(CreateTable(mytable))
        await conn.execute(mytable.insert())
        result = await conn.execute(mytable.select())
        rows = await result.fetchall()
        assert len(rows) == 1

    # Transaction should have been committed automatically
    result = await engine.execute(mytable.select())
    rows = await result.fetchall()
    assert len(rows) == 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号