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.
评论列表
文章目录