#NEWLINE# def test_plain( 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# self . create_tables ( ) #NEWLINE# sess = SomeClassHistory . session #NEWLINE# sc = SomeClass ( name = 'sc1' ) #NEWLINE# sess . add ( sc ) #NEWLINE# sess . commit ( ) #NEWLINE# sc . name = 'sc1modified' #NEWLINE# sess . commit ( ) #NEWLINE# assert ( sc . version == 2 ) #NEWLINE# SomeClassHistory = SomeClass . __history_mapper__ . class_ #NEWLINE# eq_ ( sess . query ( SomeClassHistory ) . filter ( ( SomeClassHistory . version == 1 ) ) . all ( ) , [ SomeClassHistory ( version = 1 , name = 'sc1' ) ] ) #NEWLINE# sc . name = 'sc1modified2' #NEWLINE# eq_ ( sess . query ( SomeClassHistory ) . order_by ( SomeClassHistory . version ) . all ( ) , [ SomeClassHistory ( version = 1 , name = 'sc1' ) , SomeClassHistory ( version = 2 , name = 'sc1modified' ) ] ) #NEWLINE# assert ( sc . version == 3 ) #NEWLINE# sess . commit ( ) #NEWLINE# sc . name = 'temp' #NEWLINE# sc . name = 'sc1modified2' #NEWLINE# sess . commit ( ) #NEWLINE# eq_ ( sess . query ( SomeClassHistory ) . order_by ( SomeClassHistory . version ) . all ( ) , [ SomeClassHistory ( version = 1 , name = 'sc1' ) , SomeClassHistory ( version = 2 , name = 'sc1modified' ) ] ) #NEWLINE# sess . delete ( sc ) #NEWLINE# sess . commit ( ) #NEWLINE# eq_ ( sess . query ( SomeClassHistory ) . order_by ( SomeClassHistory . version ) . all ( ) , [ SomeClassHistory ( version = 1 , name = 'sc1' ) , SomeClassHistory ( version = 2 , name = 'sc1modified' ) , SomeClassHistory ( version = 3 , name = 'sc1modified2' ) ] )