#NEWLINE# def test_w_mapper_versioning( self ) : #NEWLINE# #INDENT# class SomeClass ( Versioned , self . Base , ComparableEntity ) : #NEWLINE# #INDENT# __tablename__ = 'sometable' #NEWLINE# id = Column ( Integer , primary_key = True ) #NEWLINE# name = Column ( String ( 50 ) ) #NEWLINE# #UNINDENT# SomeClass . __mapper__ . version_id_col = SomeClass . __table__ . c . version #NEWLINE# self . create_tables ( ) #NEWLINE# sess = self . session #NEWLINE# sc = SomeClass ( name = 'sc1' ) #NEWLINE# sess . add ( sc ) #NEWLINE# sess . commit ( ) #NEWLINE# s2 = Session ( sess . bind ) #NEWLINE# sc2 = s2 . query ( SomeClass ) . first ( ) #NEWLINE# sc2 . name = 'sc1modified' #NEWLINE# sc . name = 'sc1modified_again' #NEWLINE# sess . commit ( ) #NEWLINE# eq_ ( s2 . version , 2 ) #NEWLINE# assert_raises ( orm_exc . StaleDataError , s2 . flush )