Ejemplo n.º 1
0
def test_ask_forwards_message_with_promise_actor_as_sender():
    actor = Mock(spec=ActorRef)
    message = object()
    ask(actor, message)

    assert actor.tell.call_count == 1
    assert actor.tell.call_args[0][0] is message
    assert isinstance(actor.tell.call_args[0][1], PromiseActorRef)
Ejemplo n.º 2
0
def test_system():
    class Test(Actor):
        def receive(self, message):
            self.context.sender.tell(message)

    with ActorSystem() as system:
        actor = system.actor_of(Test)
        message = object()
        reply = ask(actor, message)
        assert reply.get(timeout=1) is message