#NEWLINE# def test_storage_and_loading( self ) : #NEWLINE# #INDENT# filename = make_temp_dir ( 'linktest.hdf5' ) #NEWLINE# traj = Trajectory ( filename = filename ) #NEWLINE# traj . f_add_parameter_group ( 'test' ) #NEWLINE# traj . f_add_parameter_group ( 'test2' ) #NEWLINE# res = traj . f_add_result ( 'kk' , 42 ) #NEWLINE# traj . par . f_add_link ( 'gg' , res ) #NEWLINE# traj . f_add_link ( 'hh' , res ) #NEWLINE# traj . f_add_link ( 'jj' , traj . par ) #NEWLINE# traj . f_add_link ( 'ii' , res ) #NEWLINE# traj . test . f_add_link ( 'circle1' , traj . test2 ) #NEWLINE# traj . test2 . f_add_link ( 'circle2' , traj . test ) #NEWLINE# traj . test . f_add_link ( 'circle2' , traj . test . circle1 . circle2 ) #NEWLINE# traj . f_add_parameter_group ( 'test.ab.bc.cd' ) #NEWLINE# traj . cd . f_add_link ( traj . test ) #NEWLINE# traj . test . f_add_link ( traj . cd ) #NEWLINE# traj . f_store ( ) #NEWLINE# traj2 = Trajectory ( filename = filename ) #NEWLINE# traj2 . f_load ( name = traj . v_name , load_data = 2 ) #NEWLINE# self . assertTrue ( ( traj . kk == traj2 . gg ) , ( '%s != %s' % ( traj . kk , traj2 . gg ) ) ) #NEWLINE# self . assertTrue ( ( traj . cd . test is traj . test ) ) #NEWLINE# self . assertTrue ( len ( traj . _linked_by ) , len ( filename . _linked_by ) ) #NEWLINE# self . compare_trajectories ( traj , traj2 ) #NEWLINE# self . assertTrue ( ( 'jj' in traj2 . _nn_interface . _links_count ) ) #NEWLINE# traj2 . f_remove_child ( 'jj' ) #NEWLINE# self . assertTrue ( ( 'jj' not in traj2 . _nn_interface . _links_count ) ) #NEWLINE# traj2 . f_remove_child ( 'hh' ) #NEWLINE# traj2 . f_remove_child ( 'ii' ) #NEWLINE# traj2 . f_remove_child ( 'parameters' , recursive = True ) #NEWLINE# traj2 . v_auto_load = True #NEWLINE# group = traj2 . par . test2 . circle2 #NEWLINE# self . assertTrue ( ( group is traj2 . test ) ) #NEWLINE# retest = traj2 . test . circle1 #NEWLINE# self . assertTrue ( ( retest is traj2 . test2 ) ) #NEWLINE# self . assertTrue ( ( traj2 . test . circle2 is traj2 . test ) ) #NEWLINE# self . assertTrue ( ( traj2 . hh == traj2 . res . kk ) ) #NEWLINE# traj2 . v_auto_load = False #NEWLINE# traj2 . f_load_child ( 'jj' ) #NEWLINE# self . assertTrue ( ( traj2 . jj is traj2 . par ) ) #NEWLINE# traj2 . f_load ( load_data = 2 ) #NEWLINE# self . assertTrue ( ( traj2 . ii == traj2 . res . kk ) )