From 4c28e7f626cc4031b0749daef5e9a527b53bb8e5 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 1 Feb 2020 09:42:04 +0100 Subject: [PATCH] better have tests --- python/damask/dadf5.py | 2 +- python/tests/test_DADF5.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/python/damask/dadf5.py b/python/damask/dadf5.py index 3ee9bc1c5..819b5603e 100644 --- a/python/damask/dadf5.py +++ b/python/damask/dadf5.py @@ -491,7 +491,7 @@ class DADF5(): Indicate whether the formula is written in vectorized form. Default is ‘True’. """ - if vectorized is not True: + if vectorized is False: raise NotImplementedError def __add_calculation(**kwargs): diff --git a/python/tests/test_DADF5.py b/python/tests/test_DADF5.py index 8aa8ec174..669ce8446 100644 --- a/python/tests/test_DADF5.py +++ b/python/tests/test_DADF5.py @@ -39,6 +39,14 @@ class TestDADF5: in_file = default.read_dataset(loc['|Fe|'],0) 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): default.add_Cauchy('P','F') loc = {'F': default.get_dataset_location('F'),