示例#1
0
 def test_load_ser_sim_res_no_json(self):
     tmpfolder = gf.generate_temp_folder()
     os.makedirs(tmpfolder)
     pres = CP.load_serial_simulation_results(tmpfolder)
     shutil.rmtree(tmpfolder)
     self.assertTrue(isinstance(pres['chain'], list))
     self.assertTrue(isinstance(pres['s2chain'], list))
     self.assertEqual(pres['chain'], [])
示例#2
0
 def test_load_ser_sim_res(self):
     tmpfolder = gf.generate_temp_folder()
     tmpfolder0 = os.path.join(tmpfolder, 'chain_0')
     os.makedirs(tmpfolder0)
     tmpfile0 = 'chain_0.json'
     tmpfile0 = os.path.join(tmpfolder0, tmpfile0)
     results = dict(a=[0, 1], b='hello')
     RS = ResultsStructure()
     RS.save_json_object(results, tmpfile0)
     pres = CP.load_serial_simulation_results(tmpfolder0)
     shutil.rmtree(tmpfolder)
     self.assertTrue(isinstance(pres['a'], np.ndarray))
     self.assertTrue(isinstance(pres['b'], str))
     self.assertEqual(pres['b'], 'hello')