test_connection.py 文件源码

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

项目:sqlalchemy_aio 作者: RazerM 项目源码 文件源码
def test_close(engine):
    conn = await engine.connect()
    assert not conn.closed

    result = await conn.execute(select([1]))
    assert await result.scalar() == 1

    await conn.close()
    assert conn.closed

    with pytest.raises(StatementError) as exc:
        await conn.execute(select([1]))
    assert "This Connection is closed" in str(exc)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号