#NEWLINE# def test_column_property( self ) : #NEWLINE# #INDENT# class MyMixin ( object ) : #NEWLINE# #INDENT# @ declared_attr #NEWLINE# def prop_hoho( cls ) : #NEWLINE# #INDENT# return column_property ( Column ( 'prop' , 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# class MyOtherModel ( Base , MyMixin ) : #NEWLINE# #INDENT# __tablename__ = 'othertest' #NEWLINE# id = Column ( Integer , primary_key = True , test_needs_autoincrement = True ) #NEWLINE# #UNINDENT# assert ( MyModel . __table__ . c . prop is not None ) #NEWLINE# assert ( MyOtherModel . __table__ . c . prop is not None ) #NEWLINE# assert ( MyModel . __table__ . c . prop is not MyOtherModel . __table__ . c . prop ) #NEWLINE# assert ( MyModel . prop_hoho . property . columns == [ MyModel . __table__ . c . prop ] ) #NEWLINE# assert ( MyOtherModel . prop_hoho . property . columns == [ MyOtherModel . __table__ . c . prop ] ) #NEWLINE# assert ( MyModel . prop_hoho . property is not MyOtherModel . prop_hoho . property ) #NEWLINE# Base . metadata . create_all ( ) #NEWLINE# sess = create_session ( ) #NEWLINE# ( m1 , m2 ) = ( MyModel ( prop_hoho = 'foo' ) , MyOtherModel ( prop_hoho = 'bar' ) ) #NEWLINE# sess . add_all ( [ m1 , m2 ] ) #NEWLINE# sess . flush ( ) #NEWLINE# eq_ ( sess . query ( MyModel ) . filter ( ( MyModel . prop_hoho == 'foo' ) ) . one ( ) , m1 ) #NEWLINE# eq_ ( sess . query ( MyOtherModel ) . filter ( ( MyOtherModel . prop_hoho == 'bar' ) ) . one ( ) , m2 )