#NEWLINE# def test_before_compile( self ) : #NEWLINE# #INDENT# @ event . listens_for ( query . Query , 'before_compile' , retval = True ) #NEWLINE# def no_deleted( query ) : #NEWLINE# #INDENT# for desc in query . column_descriptions : #NEWLINE# #INDENT# if ( desc [ 'type' ] is User ) : #NEWLINE# #INDENT# entity = desc [ 'expr' ] #NEWLINE# query = query . filter ( ( entity . id != 10 ) ) #NEWLINE# #UNINDENT# #UNINDENT# return query #NEWLINE# #UNINDENT# User = self . classes . User #NEWLINE# s = Session ( ) #NEWLINE# q = s . query ( User ) . filter_by ( id = 7 ) #NEWLINE# self . assert_compile ( q , 'SELECT users.id AS users_id, users.name AS users_name FROM users WHERE users.id = :id_1 AND users.id != :id_2' , checkparams = { #NEWLINE# #INDENT# 'id_2' : 10 , #NEWLINE# 'id_1' : 7 , #NEWLINE# #UNINDENT# } )