test_io.py 文件源码

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

项目:trio 作者: python-trio 项目源码 文件源码
def test_wait_socket_type_checking(socketpair):
    a, b = socketpair

    # wait_socket_* accept actual socket objects, only
    for sock_fn in [_core.wait_socket_readable, _core.wait_socket_writable]:
        with pytest.raises(TypeError):
            await sock_fn(a.fileno())

        class AllegedSocket(stdlib_socket.socket):
            pass

        with AllegedSocket() as alleged_socket:
            with pytest.raises(TypeError):
                await sock_fn(alleged_socket)


# XX These tests are all a bit dicey because they can't distinguish between
# wait_on_{read,writ}able blocking the way it should, versus blocking
# momentarily and then immediately resuming.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号