#NEWLINE# def test_cascade( self ) : #NEWLINE# #INDENT# class T1 ( fixtures . BasicEntity ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class T2 ( fixtures . BasicEntity ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class T3 ( T2 ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class T4 ( fixtures . BasicEntity ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# mapper ( T1 , t1 , properties = { #NEWLINE# #INDENT# 't2s' : relationship ( T2 , cascade = 'all' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# mapper ( T2 , t2 , polymorphic_on = t2 . c . type , polymorphic_identity = 't2' ) #NEWLINE# mapper ( T3 , t3 , inherits = T2 , polymorphic_identity = 't3' , properties = { #NEWLINE# #INDENT# 't4s' : relationship ( T4 , cascade = 'all' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# mapper ( T4 , t4 ) #NEWLINE# sess = create_session ( ) #NEWLINE# t1_1 = T1 ( data = 't1' ) #NEWLINE# t3_1 = T3 ( data = 't3' , moredata = 't3' ) #NEWLINE# t2_1 = T2 ( data = 't2' ) #NEWLINE# t1_1 . t2s . append ( sess ) #NEWLINE# t1_1 . t2s . append ( t3_1 ) #NEWLINE# t4_1 = T4 ( data = 't4' ) #NEWLINE# t3_1 . t4s . append ( t4_1 ) #NEWLINE# sess . add ( t1_1 ) #NEWLINE# assert ( t4_1 in sess . new ) #NEWLINE# sess . flush ( ) #NEWLINE# sess . delete ( t1_1 ) #NEWLINE# assert ( t4_1 in sess . deleted ) #NEWLINE# sess . flush ( )