Beispiel #1
0
def test_close_accept_action():
    obs = [False]
    n1 = OnCompleted()

    def on_next(x):
        assert False
        return None

    def on_error(ex):
        assert False
        return None

    def on_completed():
        obs[0] = True
        return obs[0]

    n1.accept(on_next, on_error, on_completed)
    assert obs[0]
Beispiel #2
0
def test_close_accept_action_with_result():
    n1 = OnCompleted()

    def on_next(x):
        assert False
        return None

    def on_error(ex):
        assert False
        return None

    def on_completed():
        return "OK"

    res = n1.accept(on_next, on_error, on_completed)
    assert "OK" == res
Beispiel #3
0
def test_close_accept_observer_with_result():
    n1 = OnCompleted()

    def on_next(x):
        assert False
        return None

    def on_error(err):
        assert False
        return None

    def on_completed():
        return "OK"

    res = n1.accept(AcceptObserver(on_next, on_error, on_completed))
    assert "OK" == res
Beispiel #4
0
def test_close_accept_observer():
    obs = CheckOnCompletedObserver()
    n1 = OnCompleted()
    n1.accept(obs)
    assert obs.completed