#NEWLINE# @ testing . emits_warning ( '.*(update|delete)d rowcount' ) #NEWLINE# def test_delete( self ) : #NEWLINE# #INDENT# ( subtable , base ) = ( self . tables . subtable , base . tables . base ) #NEWLINE# class Base ( fixtures . BasicEntity ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class Sub ( Base ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# mapper ( Base , base , polymorphic_on = base . c . discriminator , version_id_col = base . c . version_id , polymorphic_identity = 1 ) #NEWLINE# mapper ( Sub , subtable , inherits = Base , polymorphic_identity = 2 ) #NEWLINE# sess = create_session ( ) #NEWLINE# b1 = Base ( value = 'b1' ) #NEWLINE# s1 = Sub ( value = 'sub1' , subdata = 'some subdata' ) #NEWLINE# s2 = Sub ( value = 'sub2' , subdata = 'some other subdata' ) #NEWLINE# sess . add ( b1 ) #NEWLINE# sess . add ( s1 ) #NEWLINE# sess . add ( s2 ) #NEWLINE# sess . flush ( ) #NEWLINE# sess2 = create_session ( ) #NEWLINE# s3 = sess2 . query ( Base ) . get ( s1 . id ) #NEWLINE# sess2 . delete ( s3 ) #NEWLINE# sess2 . flush ( ) #NEWLINE# s2 . subdata = 'some new subdata' #NEWLINE# sess . flush ( ) #NEWLINE# s1 . subdata = 'some new subdata' #NEWLINE# if testing . db . dialect . supports_sane_rowcount : #NEWLINE# #INDENT# assert_raises ( orm_exc . StaleDataError , sess . flush ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sess . flush ( )