Commit 1102dfb3 authored by payno's avatar payno

[unittest] fix unit test since XASObject.to_dict is storing more outputs

parent 7d4251e8
......@@ -124,9 +124,14 @@ class TestXASObject(unittest.TestCase):
original_spectra = silx.io.utils.get_data(DataUrl(file_path=filename,
data_path=spectra_path,
scheme='silx'))
numpy.testing.assert_array_equal(original_spectra, ddict['spectra'])
obj2 = XASObject.from_dict(ddict)
self.assertEqual(self.xas_obj.n_spectrum, obj2.n_spectrum)
obj2_mu_spectra = obj2._spectra_volume(spectra=obj2.spectra,
key='mu',
dim_1=obj2.dim1,
dim_2=obj2.dim2)
numpy.testing.assert_array_equal(original_spectra, obj2_mu_spectra)
self.assertEqual(obj2, self.xas_obj)
......
......@@ -840,6 +840,8 @@ class Spectrum(_Spectrum_Base):
def value_is_none(value):
if hasattr(value, 'decode'):
value = value.decode('UTF-8')
if isinstance(value, str):
return value == 'None'
else:
return value is None
......
......@@ -63,7 +63,8 @@ class TestWorkflowFunctions(unittest.TestCase):
ft_task = Node(callback=est.core.process.pymca.ft.pymca_ft)
nodes = (
read_task, normalization_task, exafs_task, k_weight_task, ft_task)
read_task, normalization_task, exafs_task, k_weight_task, ft_task
)
links = [
Link(source_node=read_task, source_channel='xas_obj',
......@@ -84,8 +85,8 @@ class TestWorkflowFunctions(unittest.TestCase):
out = exec_workflow(scheme=self.scheme, input_=self.data_file)
assert isinstance(out, dict)
xas_obj_out = XASObject.from_dict(out)
assert 'FT' in xas_obj_out.spectra[0]
assert 'FTRadius' in xas_obj_out.spectra[0].ft
self.assertTrue('FT' in xas_obj_out.spectra[0])
self.assertTrue('FTRadius' in xas_obj_out.spectra[0].ft)
@unittest.skipIf(has_pymca is False, 'PyMca5 is not installed')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment