Commit d1adc360 authored by payno's avatar payno

[test] fix some larch unit test, configuration was wrongly set

parent 86620979
......@@ -70,6 +70,8 @@ def process_spectr_mback(spectrum, configuration, overwrite=True, callbacks=None
'order', 'leexiang', 'tables', 'fit_erfc'):
if opt_name in _conf:
opts[opt_name] = _conf[opt_name]
if not 'z' in opts:
raise ValueError('atomic number of the absorber is not specify')
if _DEBUG is True:
assert isinstance(spectrum, Group)
......
......@@ -63,12 +63,12 @@ class TestLarchSpectrum(unittest.TestCase):
shutil.rmtree(self.outputdir)
def testProcess(self):
self.assertFalse(hasattr(self.spectrum, 'k'))
self.assertFalse(hasattr(self.spectrum, 'chi'))
self.assertTrue(self.spectrum.k is None)
self.assertTrue(self.spectrum.chi is None)
conf, res_spectrum = process_spectr_autobk(self.spectrum,
self.configuration)
self.assertTrue(hasattr(res_spectrum, 'k'))
self.assertTrue(hasattr(res_spectrum, 'chi'))
self.assertFalse(self.spectrum.k is None)
self.assertFalse(self.spectrum.chi is None)
@unittest.skipIf(has_larch is False, 'xraylarch not installed')
......
......@@ -57,7 +57,7 @@ class TestLarchSpectrum(unittest.TestCase):
assert os.path.exists(self.data_file)
energy, mu = read_ascii(self.data_file)
self.spectrum = Spectrum(energy=energy, mu=mu)
self.configuration = {'z': 29}
self.configuration = {'mback': {'z': 29}}
def tearDown(self):
shutil.rmtree(self.outputdir)
......@@ -84,7 +84,7 @@ class TestLarchSpectra(unittest.TestCase):
out_file.write(data)
assert os.path.exists(self.data_file)
# define the xas object
self.configuration = {'z': 29}
self.configuration = {'mback': {'z': 29}}
energy, mu = read_ascii(self.data_file)
self.xas_object = XASObject(spectra=(Spectrum(energy=energy, mu=mu),),
energy=energy, dim1=1, dim2=1,
......
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