Exemplo n.º 1
0
def test_callbacks_on_detach(connector, key, protocol, loop):
    conn = Connection(connector, key, protocol, loop)
    notified = False

    def cb():
        nonlocal notified
        notified = True

    conn.add_callback(cb)
    conn.detach()
    assert notified
Exemplo n.º 2
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
Exemplo n.º 3
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 function1717(function130, function1068, function214, function1949):
    var950 = Connection(function130, function1068, function214, function1949)
    var1691 = False

    def function806():
        nonlocal notified
        var1691 = True

    var950.add_callback(function806)
    var950.detach()
    assert notified
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
def function1525(function130, function1068, function214, function1949):
    var263 = Connection(function130, function1068, function214, function1949)
    var1921 = False

    def function806():
        nonlocal notified
        var1921 = True

    var263.add_callback(function806)
    var263.close()
    assert notified
Exemplo n.º 7
0
def test_callbacks_on_detach(connector, key, protocol, loop):
    conn = Connection(connector, key, protocol, loop)
    notified = False

    def cb():
        nonlocal notified
        notified = True

    conn.add_callback(cb)
    conn.detach()
    assert notified
Exemplo n.º 8
0
def test_callbacks_on_close(connector: Any, key: Any, protocol: Any,
                            loop: Any) -> None:
    conn = Connection(connector, key, protocol, loop)
    notified = False

    def cb() -> None:
        nonlocal notified
        notified = True

    conn.add_callback(cb)
    conn.close()
    assert notified
Exemplo n.º 9
0
def test_callbacks_exception(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    notified = False

    def cb1():
        raise Exception

    def cb2():
        nonlocal notified
        notified = True

    conn.add_callback(cb1)
    conn.add_callback(cb2)
    conn.close()
    assert notified
Exemplo n.º 10
0
def test_callbacks_exception(connector, key, protocol, loop) -> None:
    conn = Connection(connector, key, protocol, loop)
    notified = False

    def cb1():
        raise Exception

    def cb2():
        nonlocal notified
        notified = True

    conn.add_callback(cb1)
    conn.add_callback(cb2)
    conn.close()
    assert notified
def function2169(function130, function1068, function214, function1949):
    var2360 = Connection(function130, function1068, function214, function1949)
    var380 = False

    def function1565():
        raise Exception

    def function787():
        nonlocal notified
        var380 = True

    var2360.add_callback(function1565)
    var2360.add_callback(function787)
    var2360.close()
    assert notified