#NEWLINE# def test_deferred( self ) : #NEWLINE# #INDENT# class MyMixin ( object ) : #NEWLINE# #INDENT# @ declared_attr #NEWLINE# def data( cls ) : #NEWLINE# #INDENT# return deferred ( Column ( 'data' , String ( 50 ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# class MyModel ( Base , MyMixin ) : #NEWLINE# #INDENT# __tablename__ = 'test' #NEWLINE# id = Column ( Integer , primary_key = True , test_needs_autoincrement = True ) #NEWLINE# #UNINDENT# Base . metadata . create_all ( ) #NEWLINE# sess = create_session ( ) #NEWLINE# sess . add_all ( [ MyModel ( data = 'd1' ) , MyModel ( data = 'd2' ) ] ) #NEWLINE# sess . flush ( ) #NEWLINE# sess . expunge_all ( ) #NEWLINE# ( d1 , d2 ) = sess . query ( MyModel ) . order_by ( MyModel . data ) #NEWLINE# assert ( 'data' not in d2 . __dict__ ) #NEWLINE# assert ( d1 . data == 'd1' ) #NEWLINE# assert ( 'data' in d1 . __dict__ )