def function522(arg325): var1425 = mock.Mock() var383 = StreamWriter(mock.Mock(), var1425, arg325) var1622 = PayloadWriter(var383, arg325) var383.release() assert var383.available var383.acquire(var1622) assert (not var383.available) assert (var1622._transport is var1425)
def test_acquire2(loop): transport = mock.Mock() stream = StreamWriter(mock.Mock(), transport, loop) payload = PayloadWriter(stream, loop) stream.release() assert stream.available stream.acquire(payload) assert not stream.available assert payload._transport is transport
def function2667(arg185): var223 = mock.Mock() var1979 = StreamWriter(mock.Mock(), var223, arg185) var1979.available = False var4719 = mock.Mock() var1979.acquire(var4719) assert (not var1979.available) assert (not var4719.set_transport.called) var1979.release() assert (not var1979.available) var4719.set_transport.assert_called_with(var223) var1979.release() assert var1979.available
def function2166(arg634): var2824 = mock.Mock() var4275 = StreamWriter(mock.Mock(), var2824, arg634) var4275.available = False var4137 = PayloadWriter(var4275, arg634) assert (var4137._transport is None) assert (var4137 in var4275._waiters) var1377 = var4275.replace(var4137, PayloadWriter) assert (var1377._transport is None) assert (var1377 in var4275._waiters) assert (var4137 not in var4275._waiters) var4275.release() assert (var1377._transport is var2824) assert (not var4275._waiters)
def test_replace(loop): transport = mock.Mock() stream = StreamWriter(mock.Mock(), transport, loop) stream.available = False payload = PayloadWriter(stream, loop) assert payload._transport is None assert payload in stream._waiters payload2 = stream.replace(payload, PayloadWriter) assert payload2._transport is None assert payload2 in stream._waiters assert payload not in stream._waiters stream.release() assert payload2._transport is transport assert not stream._waiters
def test_release(loop): transport = mock.Mock() stream = StreamWriter(mock.Mock(), transport, loop) stream.available = False writer = mock.Mock() stream.acquire(writer) assert not stream.available assert not writer.set_transport.called stream.release() assert not stream.available writer.set_transport.assert_called_with(transport) stream.release() assert stream.available