#NEWLINE# def test_temp_connection_failure( ) : #NEWLINE# #INDENT# sig = Signal ( ) #NEWLINE# canary = [ ] #NEWLINE# receiver = ( lambda sender : canary . append ( sender ) ) #NEWLINE# class Failure ( Exception ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# sig . send ( 1 ) #NEWLINE# with sig . connected_to ( sig ) : #NEWLINE# #INDENT# sig . send ( 2 ) #NEWLINE# raise Failure #NEWLINE# #UNINDENT# sig . send ( 3 ) #NEWLINE# #UNINDENT# except Failure : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise AssertionError ( 'Context manager did not propagate.' ) #NEWLINE# #UNINDENT# assert ( canary == [ 2 ] ) #NEWLINE# assert ( not sig . receivers )