#NEWLINE# def test_on_bulk_delete_hook( self ) : #NEWLINE# #INDENT# ( User , users ) = ( self . classes . User , self . tables . users ) #NEWLINE# sess = Session ( ) #NEWLINE# canary = Mock ( ) #NEWLINE# event . listen ( sess , 'after_begin' , canary . after_begin ) #NEWLINE# event . listen ( sess , 'after_bulk_delete' , canary . after_bulk_delete ) #NEWLINE# def legacy( ses , qry , ctx , res ) : #NEWLINE# #INDENT# canary . after_bulk_delete_legacy ( ses , qry , ctx , res ) #NEWLINE# #UNINDENT# event . listen ( sess , 'after_bulk_delete' , legacy ) #NEWLINE# mapper ( User , users ) #NEWLINE# sess . query ( User ) . delete ( ) #NEWLINE# eq_ ( canary . after_begin . call_count , 1 ) #NEWLINE# eq_ ( canary . after_bulk_delete . call_count , 1 ) #NEWLINE# upd = canary . after_bulk_delete . mock_calls [ 0 ] [ 1 ] [ 0 ] #NEWLINE# eq_ ( upd . session , sess ) #NEWLINE# eq_ ( canary . after_bulk_delete_legacy . mock_calls , [ call ( sess , legacy . query , upd . context , upd . result ) ] )