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 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