#NEWLINE# def test_load_expired_on_pending( self ) : #NEWLINE# #INDENT# ( base , sub ) = ( self . tables . base , self . tables . sub ) #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 . type , polymorphic_identity = 'base' ) #NEWLINE# mapper ( Sub , sub , inherits = Base , polymorphic_identity = 'sub' ) #NEWLINE# sess = Session ( ) #NEWLINE# s1 = Sub ( data = 's1' ) #NEWLINE# sess . add ( s1 ) #NEWLINE# self . assert_sql_execution ( testing . db , sess . flush , CompiledSQL ( 'INSERT INTO base (data, type) VALUES (:data, :type)' , [ { #NEWLINE# #INDENT# 'data' : 's1' , #NEWLINE# 'type' : 'sub' , #NEWLINE# #UNINDENT# } ] ) , CompiledSQL ( 'INSERT INTO sub (id, sub) VALUES (:id, :sub)' , ( lambda ctx : { #NEWLINE# #INDENT# 'id' : s1 . id , #NEWLINE# 'sub' : None , #NEWLINE# #UNINDENT# } ) ) ) #NEWLINE# def go( ) : #NEWLINE# #INDENT# eq_ ( s1 . subcounter2 , 1 ) #NEWLINE# #UNINDENT# self . assert_sql_execution ( testing . db , go , CompiledSQL ( 'SELECT base.counter AS base_counter, sub.subcounter AS sub_subcounter, sub.subcounter2 AS sub_subcounter2 FROM base JOIN sub ON base.id = sub.id WHERE base.id = :param_1' , ( lambda ctx : { #NEWLINE# #INDENT# 'param_1' : s1 . id , #NEWLINE# #UNINDENT# } ) ) )