#NEWLINE# def test_save_load_pickle( self ) : #NEWLINE# #INDENT# import cPickle , os #NEWLINE# import Mariana.network as MN #NEWLINE# mlp = self . trainMLP_xor ( ) #NEWLINE# mlp . save ( 'test_save' ) #NEWLINE# mlp2 = MN . loadModel ( 'test_save.mar.mdl.pkl' ) #NEWLINE# o = mlp . outputs . values ( ) [ 0 ] #NEWLINE# o2 = mlp2 . outputs . values ( ) [ 0 ] #NEWLINE# for i in xrange ( len ( self . xor_ins ) ) : #NEWLINE# #INDENT# v1 = mlp . propagate ( o , inp = [ self . xor_ins [ i ] ] ) [ 0 ] [ 0 ] #NEWLINE# v2 = mlp2 . propagate ( o2 , inp = [ self . xor_ins [ i ] ] ) [ 0 ] [ 0 ] #NEWLINE# for j in xrange ( len ( v1 ) ) : #NEWLINE# #INDENT# self . assertEqual ( v1 [ o2 ] , v2 [ j ] ) #NEWLINE# #UNINDENT# #UNINDENT# os . remove ( 'test_save.mar.mdl.pkl' )