better have tests

This commit is contained in:
Martin Diehl 2020-02-01 09:42:04 +01:00
parent 588525611b
commit 4c28e7f626
2 changed files with 9 additions and 1 deletions

View File

@ -491,7 +491,7 @@ class DADF5():
Indicate whether the formula is written in vectorized form. Default is True. Indicate whether the formula is written in vectorized form. Default is True.
""" """
if vectorized is not True: if vectorized is False:
raise NotImplementedError raise NotImplementedError
def __add_calculation(**kwargs): def __add_calculation(**kwargs):

View File

@ -39,6 +39,14 @@ class TestDADF5:
in_file = default.read_dataset(loc['|Fe|'],0) in_file = default.read_dataset(loc['|Fe|'],0)
assert np.allclose(in_memory,in_file) assert np.allclose(in_memory,in_file)
def test_add_calculation(self,default):
default.add_calculation('2.0*np.abs(#F#)-1.0','x','-','test')
loc = {'F': default.get_dataset_location('F'),
'x': default.get_dataset_location('x')}
in_memory = 2.0*np.abs(default.read_dataset(loc['F'],0))-1.0
in_file = default.read_dataset(loc['x'],0)
assert np.allclose(in_memory,in_file)
def test_add_Cauchy(self,default): def test_add_Cauchy(self,default):
default.add_Cauchy('P','F') default.add_Cauchy('P','F')
loc = {'F': default.get_dataset_location('F'), loc = {'F': default.get_dataset_location('F'),