#NEWLINE# def test_decorators( self ) : #NEWLINE# #INDENT# data = [ ] #NEWLINE# @ receiver ( signals . pre_save , weak = False ) #NEWLINE# def decorated_handler( signal , sender , instance , **kwargs ) : #NEWLINE# #INDENT# data . append ( instance ) #NEWLINE# #UNINDENT# @ receiver ( signals . pre_save , sender = Car , weak = False ) #NEWLINE# def decorated_handler_with_sender_arg( signal , sender , instance , **kwargs ) : #NEWLINE# #INDENT# data . append ( instance ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# c1 = Car . objects . create ( make = 'Volkswagen' , model = 'Passat' ) #NEWLINE# self . assertEqual ( data , [ c1 , data ] ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# signals . pre_save . disconnect ( decorated_handler ) #NEWLINE# signals . pre_save . disconnect ( decorated_handler_with_sender_arg , sender = Car )