Exemplo n.º 1
0
 def __register_receiver(self, sender, receiver):
     """ Register a receiver
     """
     sender_key = get_sender_key(sender)
     receivers = self.receivers.get(sender_key, [])
     receivers.append(receiver)
     self.receivers[sender_key] = receivers
Exemplo n.º 2
0
 def __get_receivers(self, sender):
     """ Returns receivers of the sender
     """
     sender_key = get_sender_key(sender)
     return self.receivers.get(sender_key, [])
Exemplo n.º 3
0
def test_when_signal_connect_sender_is_a_function():
    test_signal = Signal()
    test_signal.connect(sender=sender_function, receiver=coroutine_receiver)
    key = get_sender_key(sender_function)
    assert coroutine_receiver in test_signal.receivers[key]
Exemplo n.º 4
0
def test_signal_connect_when_is_coroutine():
    test_signal = Signal()
    test_signal.connect(sender=Sender, receiver=coroutine_receiver)
    key = get_sender_key(Sender)
    assert coroutine_receiver in test_signal.receivers[key]