Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def meta_received(sender, **kw):
raise TypeError('boom')
assert not blinker.receiver_connected.receivers
blinker.receiver_connected.connect(meta_received)
def receiver(sender, **kw):
pass
sig = blinker.Signal()
assert_raises(TypeError, sig.connect, receiver)
assert not sig.receivers
assert not sig._by_receiver
assert sig._by_sender == {blinker.base.ANY_ID: set()}
blinker.receiver_connected._clear_state()
assert not blinker.receiver_connected.receivers
blinker.receiver_connected.connect(meta_received)
assert not sentinel
def receiver(sender, **kw):
pass
sig = blinker.Signal()
sig.connect(receiver)
assert sentinel == [dict(sender=sig,
receiver_arg=receiver,
sender_arg=blinker.ANY,
weak_arg=True)]
blinker.receiver_connected._clear_state()