Пример #1
0
def test_detach_closed(connector, key, protocol, loop):
    conn = Connection(connector, key, protocol, loop)
    conn.release()
    conn.detach()

    assert not connector._release_acquired.called
    assert conn._protocol is None
Пример #2
0
def test_detach_closed(connector, key, protocol, loop):
    conn = Connection(connector, key, protocol, loop)
    conn.release()
    conn.detach()

    assert not connector._release_acquired.called
    assert conn._protocol is None
Пример #3
0
def test_release(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    assert not conn.closed
    conn.release()
    assert not protocol.transport.close.called
    assert conn._protocol is None
    connector._release.assert_called_with(key, protocol, should_close=False)
    assert conn.closed
Пример #4
0
def test_release_released(connector, key, request, transport, protocol, loop):
    conn = Connection(connector, key, request, transport, protocol, loop)
    conn.release()
    connector._release.reset_mock()
    conn.release()
    assert not transport.close.called
    assert conn._transport is None
    assert not connector._release.called
def function546(function130, function1068, function214, function1949):
    var1045 = Connection(function130, function1068, function214, function1949)
    var1045.release()
    function130._release.reset_mock()
    var1045.release()
    assert (not function214.transport.close.called)
    assert (var1045._protocol is None)
    assert (not function130._release.called)
Пример #6
0
def test_release_released(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    conn.release()
    connector._release.reset_mock()
    conn.release()
    assert not protocol.transport.close.called
    assert conn._protocol is None
    assert not connector._release.called
Пример #7
0
def test_release(connector: Any, key: Any, protocol: Any, loop: Any) -> None:
    conn = Connection(connector, key, protocol, loop)
    assert not conn.closed
    conn.release()
    assert not protocol.transport.close.called
    assert conn._protocol is None
    connector._release.assert_called_with(key, protocol, should_close=False)
    assert conn.closed
Пример #8
0
def test_release_released(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    conn.release()
    connector._release.reset_mock()
    conn.release()
    assert not protocol.transport.close.called
    assert conn._protocol is None
    assert not connector._release.called
Пример #9
0
def test_release_released(connector, key, request, transport, protocol, loop):
    conn = Connection(connector, key, request,
                      transport, protocol, loop)
    conn.release()
    connector._release.reset_mock()
    conn.release()
    assert not transport.close.called
    assert conn._transport is None
    assert not connector._release.called
Пример #10
0
 def test_release(self):
     conn = Connection(
         self.connector, self.key, self.request,
         self.transport, self.protocol)
     conn.release()
     self.assertFalse(self.transport.close.called)
     self.assertIsNone(conn._transport)
     self.connector._release.assert_called_with(
         self.key, self.request, self.transport, self.protocol)
Пример #11
0
 def test_release(self):
     conn = Connection(self.connector, self.key, self.request,
                       self.transport, self.protocol)
     conn.release()
     self.assertFalse(self.transport.close.called)
     self.assertIsNone(conn._transport)
     self.connector._release.assert_called_with(self.key, self.request,
                                                self.transport,
                                                self.protocol)
Пример #12
0
def test_release_proto_should_close(connector, key, protocol, loop) -> None:
    protocol.should_close = True
    conn = Connection(connector, key, protocol, loop)
    assert not conn.closed
    conn.release()
    assert not protocol.transport.close.called
    assert conn._protocol is None
    connector._release.assert_called_with(key, protocol, should_close=True)
    assert conn.closed
Пример #13
0
 def test_release_released(self):
     conn = Connection(self.connector, self.key, self.request,
                       self.transport, self.protocol, self.loop)
     conn.release()
     self.connector._release.reset_mock()
     conn.release()
     self.assertFalse(self.transport.close.called)
     self.assertIsNone(conn._transport)
     self.assertFalse(self.connector._release.called)
Пример #14
0
 def test_release_released(self):
     conn = Connection(
         self.connector, self.key, self.request,
         self.transport, self.protocol, self.loop)
     conn.release()
     self.connector._release.reset_mock()
     conn.release()
     self.assertFalse(self.transport.close.called)
     self.assertIsNone(conn._transport)
     self.assertFalse(self.connector._release.called)
def function766(function130, function1068, function214, function1949):
    var1036 = Connection(function130, function1068, function214, function1949)
    assert (not var1036.closed)
    var1036.release()
    assert (not function214.transport.close.called)
    assert (var1036._protocol is None)
    function130._release.assert_called_with(function1068,
                                            function214,
                                            should_close=False)
    assert var1036.closed
Пример #16
0
def test_release(connector, key, request, transport, protocol, loop):
    conn = Connection(connector, key, request,
                      transport, protocol, loop)
    assert not conn.closed
    conn.release()
    assert not transport.close.called
    assert conn._transport is None
    connector._release.assert_called_with(
        key, request, transport, protocol,
        should_close=False)
    assert conn.closed
Пример #17
0
def test_release(connector, key, request, transport, protocol, loop):
    conn = Connection(connector, key, request,
                      transport, protocol, loop)
    assert not conn.closed
    conn.release()
    assert not transport.close.called
    assert conn._transport is None
    connector._release.assert_called_with(
        key, request, transport, protocol,
        should_close=False)
    assert conn.closed
Пример #18
0
def test_callbacks_on_release(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    notified = False

    def cb():
        nonlocal notified
        notified = True

    conn.add_callback(cb)
    conn.release()
    assert notified
def function1918(function130, function1068, function214, function1949):
    function214.should_close = True
    var3825 = Connection(function130, function1068, function214, function1949)
    assert (not var3825.closed)
    var3825.release()
    assert (not function214.transport.close.called)
    assert (var3825._protocol is None)
    function130._release.assert_called_with(function1068,
                                            function214,
                                            should_close=True)
    assert var3825.closed
def function2437(function130, function1068, function214, function1949):
    var374 = Connection(function130, function1068, function214, function1949)
    var1711 = False

    def function806():
        nonlocal notified
        var1711 = True

    var374.add_callback(function806)
    var374.release()
    assert notified
Пример #21
0
def test_callbacks_on_release(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    notified = False

    def cb():
        nonlocal notified
        notified = True

    conn.add_callback(cb)
    conn.release()
    assert notified
def function2180(function130, function1068, function214, function1949):
    var3947 = Connection(function130, function1068, function214, function1949)
    var3947.release()
    var3947.detach()
    assert (not function130._release_acquired.called)
    assert (var3947._protocol is None)