#NEWLINE# @ skipIfDBFeature ( 'can_defer_constraint_checks' ) #NEWLINE# def test_cannot_defer_constraint_checks( self ) : #NEWLINE# #INDENT# u = User . objects . create ( avatar = Avatar . objects . create ( ) ) #NEWLINE# calls = [ ] #NEWLINE# def noop( * args , **kwargs ) : #NEWLINE# #INDENT# calls . append ( '' ) #NEWLINE# #UNINDENT# models . signals . post_delete . connect ( noop , sender = User ) #NEWLINE# a = Avatar . objects . get ( pk = u . avatar_id ) #NEWLINE# self . assertNumQueries ( 4 , a . delete ) #NEWLINE# self . assertFalse ( User . objects . exists ( ) ) #NEWLINE# self . assertFalse ( Avatar . objects . exists ( ) ) #NEWLINE# self . assertEqual ( len ( calls ) , 1 ) #NEWLINE# models . signals . post_delete . disconnect ( noop , sender = User )