#NEWLINE# def testRevertWithDelete( self ) : #NEWLINE# #INDENT# with create_revision ( ) : #NEWLINE# #INDENT# test23 = ReversionTestModel2 . objects . create ( name = 'model2 instance3 version1' ) #NEWLINE# self . follow1 . test_model_2s . add ( test23 ) #NEWLINE# self . follow1 . save ( ) #NEWLINE# #UNINDENT# self . assertEqual ( get_for_object ( test23 ) . count ( ) , 1 ) #NEWLINE# self . assertEqual ( self . follow1 . test_model_2s . all ( ) . count ( ) , 3 ) #NEWLINE# test23_pk = test23 . pk #NEWLINE# self . assertEqual ( ReversionTestModel2 . objects . count ( ) , 3 ) #NEWLINE# with create_revision ( ) : #NEWLINE# #INDENT# get_for_object ( self . follow1 ) [ 1 ] . revision . revert ( delete = True ) #NEWLINE# #UNINDENT# self . assertEqual ( ReversionTestModel1 . objects . get ( id = self . test11 . pk ) . name , 'model1 instance1 version1' ) #NEWLINE# self . assertEqual ( ReversionTestModel2 . objects . get ( id = self . test22 . pk ) . name , 'model2 instance2 version1' ) #NEWLINE# self . assertEqual ( ReversionTestModel2 . objects . get ( id = self . test22 . pk ) . name , 'model2 instance2 version1' ) #NEWLINE# self . assertEqual ( ReversionTestModel2 . objects . count ( ) , 2 ) #NEWLINE# self . assertRaises ( ReversionTestModel2 . DoesNotExist , ( lambda : ReversionTestModel2 . objects . get ( id = test23_pk ) ) ) #NEWLINE# get_for_object ( self . follow1 ) [ 1 ] . revision . revert ( ) #NEWLINE# self . assertEqual ( self . follow1 . test_model_2s . all ( ) . count ( ) , 3 ) #NEWLINE# get_for_object ( self . follow1 ) [ 0 ] . revision . revert ( delete = True ) #NEWLINE# self . assertEqual ( self . follow1 . test_model_2s . all ( ) . count ( ) , 2 )