#NEWLINE# @ with_model #NEWLINE# def test_model_pickle( ) : #NEWLINE# #INDENT# import pickle #NEWLINE# A = Monomer ( 'A' , _export = False ) #NEWLINE# B = Monomer ( 'B' , [ 'x' , 'y' ] , { #NEWLINE# #INDENT# 'x' : [ 'e' , 'f' ] , #NEWLINE# #UNINDENT# } , _export = False ) #NEWLINE# k = Parameter ( 'k' , 1.0 , _export = False ) #NEWLINE# r = Rule ( 'r' , ( ( A ( ) + B ( x = 'e' , y = WILD ) ) >> ( A ( ) % B ( x = 'f' , y = None ) ) ) , k , _export = False ) #NEWLINE# o = Observable ( 'o' , ( A ( ) % B ( ) ) , _export = False ) #NEWLINE# e = Expression ( 'e' , ( k * o ) , _export = False ) #NEWLINE# c = Compartment ( 'c' , None , 3 , k , _export = False ) #NEWLINE# for comp in [ A , k , k , r , o , e , c ] : #NEWLINE# #INDENT# model . add_component ( comp ) #NEWLINE# #UNINDENT# model . add_component ( c ) #NEWLINE# Initial ( ( A ( ) ** c ) , k ) #NEWLINE# assert_equal ( len ( model . all_components ( ) ) , 7 ) #NEWLINE# model2 = pickle . loads ( pickle . dumps ( model ) ) #NEWLINE# check_model_against_component_list ( model , model2 . all_components ( ) )