#NEWLINE# def _fixture( self , include_address = False ) : #NEWLINE# #INDENT# ( users , User ) = ( self . tables . users , self . classes . User ) #NEWLINE# if include_address : #NEWLINE# #INDENT# ( addresses , Address ) = ( self . tables . addresses , self . classes . Address ) #NEWLINE# mapper ( User , users , properties = { #NEWLINE# #INDENT# 'addresses' : relationship ( Address , cascade = 'all, delete-orphan' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# mapper ( Address , addresses ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mapper ( User , users ) #NEWLINE# #UNINDENT# listener = Mock ( ) #NEWLINE# sess = Session ( ) #NEWLINE# def start_events( ) : #NEWLINE# #INDENT# event . listen ( sess , 'transient_to_pending' , listener . transient_to_pending ) #NEWLINE# event . listen ( sess , 'pending_to_transient' , listener . pending_to_transient ) #NEWLINE# event . listen ( sess , 'persistent_to_transient' , listener . persistent_to_transient ) #NEWLINE# event . listen ( sess , 'pending_to_persistent' , listener . pending_to_persistent ) #NEWLINE# event . listen ( sess , 'detached_to_persistent' , listener . detached_to_persistent ) #NEWLINE# event . listen ( sess , 'loaded_as_persistent' , listener . loaded_as_persistent ) #NEWLINE# event . listen ( sess , 'persistent_to_detached' , listener . persistent_to_detached ) #NEWLINE# event . listen ( sess , 'deleted_to_detached' , listener . deleted_to_detached ) #NEWLINE# event . listen ( sess , 'persistent_to_deleted' , listener . persistent_to_deleted ) #NEWLINE# event . listen ( sess , 'deleted_to_persistent' , listener . deleted_to_persistent ) #NEWLINE# return listener #NEWLINE# #UNINDENT# if include_address : #NEWLINE# #INDENT# return ( sess , User , Address , start_events ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( sess , User , start_events )