示例#1
0
 def test_get_file_missing_param(self):
     desc = "soap"
     aid = "aid_111"
     r4 = Store("./tests/results/")
     res = np.array([[1, 2, 3], [4, 5, 6]])
     r4.store(res, desc, aid, rcut=9, nmax=10, lmax=10)
     ret_val2 = r4._get_file(aid, desc, rcut=9, lmax=10)
     assert ret_val2 == None
     shutil.rmtree("./tests/results/")
示例#2
0
 def test_get_file_string(self):
     r3 = Store("./tests/results")
     result = "Random test result"
     desc = "test"
     aid = "12"
     r3.store(result, desc, aid, arg_a=1, arg_b=2)
     ret_val3 = r3._get_file(desc, aid, arg_a=1, arg_b=2)
     assert ret_val3 == result
     shutil.rmtree("./tests/results/")
示例#3
0
 def test_get_file_numpy_array(self):
     '''Tests to make sure get_descriptor returns expected value'''
     desc = "soap"
     aid = "aid_111"
     r4 = Store("./tests/results/")
     res = np.array([[1, 2, 3], [4, 5, 6]])
     r4.store(res, desc, aid, rcut=9, nmax=10, lmax=10)
     ret_val = r4._get_file(desc, aid, rcut=9, nmax=10, lmax=10)
     assert np.array_equal(ret_val, res)
     shutil.rmtree("./tests/results/")
示例#4
0
 def test_store(self):
     '''Tests storing results as a numpy array or other type'''
     r3 = Store("./tests/results")
     result = "Random test result"
     desc = "test_desc"
     aid = "111"
     kw1 = "option_1"
     kw2 = "option_2"
     r3.store(result, desc, aid, a=kw1, b=kw2)
     fname = r3._generate_file_name(desc, aid, a=kw1, b=kw2)
     fpath = os.path.join(r3.root, desc, aid, fname)
     assert os.path.exists(fpath)
     shutil.rmtree("./tests/results/")