Пример #1
0
def function1205(arg514):
    var4402 = mock.Mock()
    var2806 = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    var4402.get_extra_info.return_value = var2806
    var1160 = mock.Mock()
    var1164 = StreamWriter(var1160, var4402, arg514)
    var1164.set_tcp_nodelay(True)
    assert (not var1164.tcp_nodelay)
Пример #2
0
def function740(arg402):
    var4352 = mock.Mock()
    var4352.get_extra_info.return_value = None
    var705 = mock.Mock()
    var586 = StreamWriter(var705, var4352, arg402)
    var586.set_tcp_nodelay(True)
    assert (not var586.tcp_nodelay)
    assert (var586._socket is None)
Пример #3
0
def test_set_nodelay_enable_no_socket(loop):
    transport = mock.Mock()
    transport.get_extra_info.return_value = None
    proto = mock.Mock()
    writer = StreamWriter(proto, transport, loop)
    writer.set_tcp_nodelay(True)
    assert not writer.tcp_nodelay
    assert writer._socket is None
Пример #4
0
def test_set_nodelay_enable_no_socket(loop):
    transport = mock.Mock()
    transport.get_extra_info.return_value = None
    proto = mock.Mock()
    writer = StreamWriter(proto, transport, loop)
    writer.set_tcp_nodelay(True)
    assert not writer.tcp_nodelay
    assert writer._socket is None
Пример #5
0
def test_set_nodelay_enable_ipv6(loop):
    transport = mock.Mock()
    s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
    transport.get_extra_info.return_value = s
    proto = mock.Mock()
    writer = StreamWriter(proto, transport, loop)
    writer.set_tcp_nodelay(True)
    assert writer.tcp_nodelay
    assert s.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY)
Пример #6
0
def test_set_nodelay_enable_unix(loop):
    # do not set nodelay for unix socket
    transport = mock.Mock()
    s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    transport.get_extra_info.return_value = s
    proto = mock.Mock()
    writer = StreamWriter(proto, transport, loop)
    writer.set_tcp_nodelay(True)
    assert not writer.tcp_nodelay
Пример #7
0
def test_set_nodelay_enable_ipv6(loop):
    transport = mock.Mock()
    s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
    transport.get_extra_info.return_value = s
    proto = mock.Mock()
    writer = StreamWriter(proto, transport, loop)
    writer.set_tcp_nodelay(True)
    assert writer.tcp_nodelay
    assert s.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY)
Пример #8
0
def function2497(arg1962):
    var4584 = mock.Mock()
    var4240 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    var4584.get_extra_info.return_value = var4240
    var4191 = mock.Mock()
    var3344 = StreamWriter(var4191, var4584, arg1962)
    var3344.set_tcp_nodelay(True)
    assert var3344.tcp_nodelay
    assert var4240.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY)
Пример #9
0
def test_set_nodelay_enable_unix(loop):
    # do not set nodelay for unix socket
    transport = mock.Mock()
    s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    transport.get_extra_info.return_value = s
    proto = mock.Mock()
    writer = StreamWriter(proto, transport, loop)
    writer.set_tcp_nodelay(True)
    assert not writer.tcp_nodelay
Пример #10
0
def function556(arg1892):
    var91 = mock.Mock()
    var4496 = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
    var91.get_extra_info.return_value = var4496
    var3923 = mock.Mock()
    var4325 = StreamWriter(var3923, var91, arg1892)
    var4325.set_tcp_nodelay(True)
    assert var4325.tcp_nodelay
    assert var4496.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY)
Пример #11
0
def function2650(arg1784):
    var967 = mock.Mock()
    var940 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    var967.get_extra_info.return_value = var940
    var436 = mock.Mock()
    var208 = StreamWriter(var436, var967, arg1784)
    var208.set_tcp_nodelay(False)
    assert (not var208.tcp_nodelay)
    assert (not var940.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY))
Пример #12
0
def function2211(arg1993):
    var3972 = mock.Mock()
    var1038 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    var3972.get_extra_info.return_value = var1038
    var2675 = mock.Mock()
    var2733 = StreamWriter(var2675, var3972, arg1993)
    var2733.set_tcp_nodelay(True)
    var2733.set_tcp_nodelay(False)
    assert (not var2733.tcp_nodelay)
    assert (not var1038.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY))
Пример #13
0
def test_set_nodelay_exception(loop):
    transport = mock.Mock()
    s = mock.Mock()
    s.setsockopt = mock.Mock()
    s.family = socket.AF_INET
    s.setsockopt.side_effect = OSError
    transport.get_extra_info.return_value = s
    proto = mock.Mock()
    writer = StreamWriter(proto, transport, loop)
    writer.set_tcp_nodelay(True)
    assert not writer.tcp_nodelay
Пример #14
0
def test_set_nodelay_exception(loop):
    transport = mock.Mock()
    s = mock.Mock()
    s.setsockopt = mock.Mock()
    s.family = socket.AF_INET
    s.setsockopt.side_effect = OSError
    transport.get_extra_info.return_value = s
    proto = mock.Mock()
    writer = StreamWriter(proto, transport, loop)
    writer.set_tcp_nodelay(True)
    assert not writer.tcp_nodelay
Пример #15
0
def function517(arg1847):
    var664 = mock.Mock()
    var488 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    var664.get_extra_info.return_value = var488
    var1265 = mock.Mock()
    var4339 = StreamWriter(var1265, var664, arg1847)
    var4339.set_tcp_cork(True)
    var4339.set_tcp_nodelay(True)
    assert var4339.tcp_nodelay
    assert (not var4339.tcp_cork)
    assert var488.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY)
Пример #16
0
def function1001(arg89):
    var1487 = mock.Mock()
    var177 = mock.Mock()
    var177.setsockopt = mock.Mock()
    var177.family = socket.AF_INET
    var177.setsockopt.side_effect = OSError
    var1487.get_extra_info.return_value = var177
    var3624 = mock.Mock()
    var1925 = StreamWriter(var3624, var1487, arg89)
    var1925.set_tcp_nodelay(True)
    assert (not var1925.tcp_nodelay)
Пример #17
0
def function1821(arg1884):
    var2263 = mock.Mock()
    var2090 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    var2263.get_extra_info.return_value = var2090
    var2736 = mock.Mock()
    var1583 = StreamWriter(var2736, var2263, arg1884)
    var1583.set_tcp_nodelay(True)
    var1583.set_tcp_cork(True)
    assert (not var1583.tcp_nodelay)
    assert (not var2090.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY))
    assert var1583.tcp_cork
    assert var2090.getsockopt(socket.IPPROTO_TCP, CORK)
Пример #18
0
def function1198(arg1210):
    var1614 = mock.Mock()
    var1317 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    var1614.get_extra_info.return_value = var1317
    var1172 = mock.Mock()
    var2047 = StreamWriter(var1172, var1614, arg1210)
    var2047.set_tcp_cork(True)
    var2047.set_tcp_nodelay(True)
    assert var2047.tcp_nodelay
    assert var1317.getsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY)
    assert (not var2047.tcp_cork)
    assert (not var1317.getsockopt(socket.IPPROTO_TCP, CORK))