#NEWLINE# def test_save_rollover_different( self ) : #NEWLINE# #INDENT# 'Test saving file with one-file rollover and a different filename\n        ' #NEWLINE# state [ 'a' ] = ( ( - 1 ) ** 2 ) #NEWLINE# state [ 'b' ] = ( ( - 1 ) ** 3 ) #NEWLINE# state [ 'c' ] = 41 #NEWLINE# with tempfile . NamedTemporaryFile ( ) as temp , tempfile . NamedTemporaryFile ( ) as temp2 : #NEWLINE# #INDENT# state . save ( temp2 . name , rotate_n_state_files = 1 ) #NEWLINE# state . load ( temp2 . name ) #NEWLINE# state [ 'a' ] = ( ( - 1 ) ** 2 ) #NEWLINE# state . save ( temp . name , rotate_n_state_files = 1 ) #NEWLINE# for i in range ( 10 ) : #NEWLINE# #INDENT# state [ 'a' ] = ( i ** 2 ) #NEWLINE# state [ 'b' ] = ( i ** 3 ) #NEWLINE# state [ 'c' ] = ( 42 + i ) #NEWLINE# state . save ( temp . name , rotate_n_state_files = 1 ) #NEWLINE# state . load ( ( temp . name + '.1' ) , lazy = True ) #NEWLINE# self . assertEqual ( state [ 'a' ] , ( ( self - 1 ) ** 2 ) ) #NEWLINE# self . assertEqual ( state [ 'b' ] , ( ( i - 1 ) ** 3 ) ) #NEWLINE# self . assertEqual ( state [ 'c' ] , ( 42 + ( i - 1 ) ) ) #NEWLINE# state . load ( temp . name , lazy = True ) #NEWLINE# self . assertEqual ( state [ 'a' ] , ( i ** 2 ) ) #NEWLINE# self . assertEqual ( state [ 'b' ] , ( i ** 3 ) ) #NEWLINE# self . assertEqual ( state [ 'c' ] , ( 42 + i ) ) #NEWLINE# #UNINDENT# os . remove ( ( temp . name + '.1' ) ) #NEWLINE# os . remove ( ( temp2 . name + '.1' ) )